Yuav Sau Tus Txhais Lus Li Cas

Cov txheej txheem:

Yuav Sau Tus Txhais Lus Li Cas
Yuav Sau Tus Txhais Lus Li Cas

Video: Yuav Sau Tus Txhais Lus Li Cas

Video: Yuav Sau Tus Txhais Lus Li Cas
Video: 7 nqi lus qhia, piv kev kawm thiab kev ua neej sib txawv li cas? 2024, Hlis ntuj nqeg
Anonim

Muaj ntau yam lus programming uas muaj lawv tus kheej cov yam ntxwv tshwj xeeb. Tab sis yuav kom ib qho kev zov me nyuam sau hauv ib qho ntawm lawv ua haujlwm, koj yuav tsum tshaj tawm nws. Qee zaum cov lus sau tau tsim los rau lawv cov kev xav tau (piv txwv, txhawb kev hloov kho hauv cov ntawv thov loj) thiab tom qab ntawd nws tsim nyog los sau tus neeg txhais lus.

Yuav sau tus txhais lus li cas
Yuav sau tus txhais lus li cas

Tsim nyog

  • - cov txheej txheem lus ntuj lossis BNF ntawm hom lus;
  • - cov cuab yeej tsim kho.

Cov Lus Qhia

Kauj ruam 1

Npaj cov ntaub ntawv rau kev tsom xam lexical ntawm cov ntawv nyeem hauv hom lus. Sau tag nrho cov tokens hauv hom lus. Txhaum lawv rau hauv pawg (cov ntsiab lus tseem ceeb, cov lej thiab cov hlua ntawm cov ntawv nyeem, tus cim, tus npliag, cim sau ntawv, thiab lwm yam).

Kauj ruam 2

Ua kom tiav chav kawm lossis lxer. Ntawm cov tswv yim, nws yuav tsum tau txais cov " raw "cov ntaub ntawv tawm, thiab ntawm cov tso tawm tsim cov npe ntawm cov khoom muaj cov tokens thiab lawv cov cim ntaus cim hauv cov txheej txheem uas lawv tshwm sim hauv cov ntawv nyeem. ib-qib "scanner. Kev siv rov ua yuam kev tsis paub qhov tseeb. Cov cim tsis raug yuav tsum raug kho raws li tsis raug.

Kauj ruam 3

Npaj cov ntaub ntawv rau parsing. Raws li cov qauv sau ntawv ntuj lossis BNF ntawm hom lus, suav sau nws LL1 hom sau ntawv. Raws li hom qauv sau ntawv no, teeb cov ntsiab lus ib kab lus cov ntsiab lus ntawm cov pawg ntawm cov tokens siv tau thiab cov kev cai sib luag ntawm cov lus.

Kauj ruam 4

Ua lub module lossis parser. Ntawm cov tswv yim, nws yuav tsum tau txais cov npe ntawm tokens npaj nyob rau theem ntawm lexical parsing. Tsim recursive syntax xyuas algorithms siv schema koj tsim nyob rau hauv kauj ruam peb. Yog tias tsim nyog, siv cov kev ua yuam kev rov ua haujlwm. Ntxiv rau kev ua haujlwm rau kev txheeb xyuas cov txheej txheem los ua ib tsob ntoo rau kev suav lub zog, cov qauv hauv chav kawm. Nrog cov qauv tseeb ntawm kev cais parses, qhov kev ua haujlwm no tuaj yeem ua tiav tsis muaj teeb meem. Qhov no zam qhov yuav tsum tau ua nws ua ib qho qauv nyias. Cov qauv tsim cov ntaub ntawv yuav tsum muaj cov npe ntawm cov lus qhia hauv daim ntawv ntawm "tiaj" (kev ua lej nrog nthuav dav rau hauv cov ntawv xa tom qab uas tsim nyog rau kev suav ntawm lub tshuab ua haujlwm, loops hloov mus ua kev sib txuas ntawm cov kab lus ntawm cov lus qhia kev suav thiab cov kev cai jumps lossis yam tsis ua haujlwm, thiab lwm yam) Cov.

Kauj ruam 5

Tsim ib qho kev hloov kho dua tshiab yog xav tau. Nws yuav tsum ua cov txheej txheem thiab hloov kho cov ntaub ntawv cov qauv npaj hauv qib dhau los. Txhim kho algorithms thiab cov hau kev muaj ntau yam sib txawv.

Kauj Ruam 6

Tsim qhov chaws tsim hluav taws xob. Thaum ua cov txheej txheem npaj hauv plaub los yog theem tsib, nws yuav tsum tsuas yog hloov pauv ntawm cov lus qhia paub daws teeb rau hauv cov lus qhia rau kev tua ntawm lub platform tshwj xeeb.

Kauj Ruam 7

Tsim qhov kev pab cuam binder (linker) yog tias xav tau. Nws yuav tsum tsim cov txheej txheem ua tiav los ntawm kev xaiv qhov chaw nyob ntawm cov lej ntu, xam cov chaw nyob ntawm cov ntawv lo, thiab lwm yam.

Pom zoo: