Dab tsi yog tsob ntoo parse hauv compiler tsim?
Dab tsi yog tsob ntoo parse hauv compiler tsim?

Video: Dab tsi yog tsob ntoo parse hauv compiler tsim?

Video: Dab tsi yog tsob ntoo parse hauv compiler tsim?
Video: Понимание общих условий строительного контракта (AIA A201) 2024, Kaum ib hlis
Anonim

Parse tsob ntoo yog ib tug hierarchical qauv uas sawv cev rau derivation ntawm cov qauv sau ntawv los tawm tswv yim cov hlua.

Tsis tas li ntawd, dab tsi yog tsob ntoo parse hauv kev tsim kho compiler?

A parse tsob ntoo los yog paring tsob ntoo los yog derivation tsob ntoo los yog pob zeb syntax tsob ntoo yog ib qho xaj, rooted tsob ntoo uas sawv cev rau cov qauv syntactic ntawm ib txoj hlua raws li qee qhov ntsiab lus tsis muaj kab lus.

Ib sab saum toj, koj txhais li cas los ntawm parse ntoo? A parse tsob ntoo yog ib qho chaw uas sawv cev rau cov qauv ntawm qhov kev txiav txim ntawm ib txoj hlua davhlau ya nyob twg los ntawm qee qhov tsis yog lub davhlau ya nyob twg (tsis tas yuav pib lub cim). Cov txhais yog zoo li hauv phau ntawv. Cov yam ntxwv tseem ceeb los txhais yog lub hauv paus ∈ V thiab tawm los ∈ Σ* ntawm txhua tus tsob ntoo.

Ua raws li qhov no hauv kev xav, dab tsi yog parsing hauv compiler tsim?

Parser yog a compiler uas yog siv los rhuav tshem cov ntaub ntawv mus rau hauv cov ntsiab lus me me los ntawm lexical tsom xam theem. A parser siv tswv yim nyob rau hauv daim ntawv ntawm ib theem zuj zus ntawm tokens thiab tsim tawm nyob rau hauv daim ntawv ntawm parse tsob ntoo.

Dab tsi yog qhov txawv ntawm parse tree thiab syntax tree?

Dab tsi yog qhov Qhov txawv ntawm Parse Tree thiab Syntax Tree . A parse tsob ntoo yog ib qho kev sawv cev ntawm cov tswv yim. Nws muaj tag nrho cov ntaub ntawv hais txog cov tswv yim. Ntawm qhov tod tes, a tsob ntoo syntax sawv cev rau syntax ntawm ib hom lus programming li a tsob ntoo.

Pom zoo: