You are on page 1of 26
. He, : CoMPILER ESIGN — Deit- 4 Symbel table Pragya Caw Symbol tobh ts a dota Sructure. meor| to cellect Indormation aboul names abbsatny (nth goura Program. AY Kanbe track abeul he Scop. | bi neling information abeul names. Reach entry wn We 2ymbel stable hos a oir af tom se“ and Whorreatio . ~ Information consiath ef attributes abboding on “the ro ‘ ii Kao] in He Rlohanewer arame tb ersurteved , tls chocl ‘ Symbol -tabl to SEE y alveacly egints, id nota ned ik rected + % An some cases . Ho Symbal fobs | yeeord Dis created by the Doxiod onalygovipasoctepyy os te fom wb encountere] in We 3|P, anal te attribuke ef He rams ave entered chon hs declatalion iy processes! - BPerchions sh a Symbal sobl— — Deterniw whelhu’ a Slven name ip jo the table = Bad a wo pera fo “Ha olbhe — econ me oreciated| +o a gwen nan. - Add nso ine Lor a sloen roomy — Delete X norre from tHe abl, . = CD Smblerontehon 4 Symbol “plahe Zach exry in @ymbsl “able can be inplarrentes| % A wecord rot consists aA Beverol dields < Ta ewhies in symbol abl, records are nef uniform fe and cptrd en the rogram elemont identi fed by the name, Yames £ 2ymbel sulle veovd ~ “The Zimbles\ boay to imnlplnen+ a ayrnbo! abe, i tp a Linear ray ef records , On aecord per rame- sp malhed is abrepeiate “4 > wk Bengt of Jebriifter te dofinsel Ae nw Sars on are Sergi 4 we ue an anya of charchey ard a coun Yo don: 4) {dori fier * 7 ‘ he rk gia doe position of He fins chorcler 14. inglivect scheme perils “He gt qf he rome gic itselt dy yermen & congeurd + Ye Epps Sint &. identifier i siory TH in Ww Aymbl jobl, Pregy Ratq Aructuve Sov Symbol stable :- B The Symbol salle is searched exer Sime an id if) a se nomg ey nO {s entountered , ded “ave oddacl info about on existing nome \s Aigcavered - hus we wed aq achama thot alloog US enhies and Sind oxic eniheied (6 atable efficiently . Symbol tabh vege ynachoniems sre D Une Gat 2» hee S hosh tobk PSS (Ja? 4.7 Us} as Wwe zimblast ond eoay As Implant code sshanchore ter gymbd “ble la \incor Wish - An Mish we wea siqk array Jo steve rows and Awsir oyscctated atmbulas. —— Pe Yo vormes are added inthe Mab ints order ty tabich thay are. encountered actle theres infe obeul a nowy , ftard seatch fiom the byjniny ef the anny up-to dhe position reostkasl by beinker FIAIL. ( indicarben the et ia reise id we reach @ AVAIL wl indy he YONG We. =e 20 o oud Ce Men Ib not in Aymbd P42) YY to \nebert oc ntto name, On donor ths Mae by sole iL ty nok allendy there » i no daubtr, woe STE Avo rome in He Aha we fo bninadle- ferro ALANL aro) incrend “ty pointer be) width ha £Arbla tolohk ¥8cord cieee a mintmuny possibly shou. js token Dis adoantege : S34 a nowe, rare bs Wwnrtey ine tools n rams. He nicemsy work. tls profeliow? te (alo helt Orgs” lists Ado g LINK fielel to ench record ancl naa ve ain Sench _ he LBL Tr She orca nelictesh by lsd CPEs. Lohan a nore i reprecnod *T toe move. He recore] br dhoat hare foe from af the ish by moorry bornder Tre advantage b a naman TARE Id Hy mY 5 me nec) TagH Hh will denc| to bs ak se rook ef dst, + (y ag He Bear weer C Binary Search Tree) ‘tank Be te add too ink ofields- WMV Leet & RigHT +o each tecord - e coe, Unt > elds to Link He. vecordo Inte a bine earch Sree “Ive ~ ree hos He property “thee ot nodes NE acconalake fom Ni by follow izf tho Link LEFT? sagan a Sinks ‘sill byeuole and thon Nooovng On WP iy etpiatetial © ord, bee - Sobbaly oft pores OK ace ons ble starting with Riatit; will have Me propedy that Ni eM s (419 hosts shu 4 seardlvrs Jor NAME arol have fourd th Necord we NE be only -p low LEFT? 4 NAME 2; and nysal only fallow RIGHT T if name > Ni Ages thn to Apok fr MAME in a binary search tre Pi initially poles *e she root - D while PF null Ao iy MAME = N(PD nen {U.fovn B') | ram frurof e che NAME < NCP thw Nps ceer(e) I! visit Left child eda de. te VE 2 nO) p= alarte ce) yy (isi) eeyht chil Qe Redeate the oa . “tne “wee. Te equir® ateol ea ahold be @ : Bot ursve teal peme od ingestion Ae is the ww we is Ol Joy "YD kab Ayre i Bosh lable 25 : tah elieclene iy Ye rot, coneemn, then hesh +bQ ip Ye baller “imathod ue the bina pees sree The Fire dev search in he iA m of Ko. of elements stove int NAME th p= e — stall, , ahorh bb and a aferage he qr. A “posh table iy an) ane th % Dn inde UAV FPL T° do lekermire yh) Mameciming. the &ymbsl HZ hea ably hosh ‘fanction fe Name Auch Hat h(ramy) 1b On Heer berboeen 0 te Ky BA ih on “the Sat numbensel 4 (Ware) Yat tHe record me Sy wo Narre belong a/a) Activation Record :- frosts An Betivivtion Record ts te collection ef al the dixecl 2132 dtorage. aspires} by yawolales declesres! wy one breaduve inte o Single block of grorag . Te oclio ation vecove conten ~foltousing thems b Brovase, fox simble romes , pointeys to arrays ano] other dat, structure loco 4o the procedure - = “Tem borames be exp evaluabion & parame Jer passing. @) info tering altibutes for local rames ond Qovrol, parameleas, 4) The volun address. S) A pointy to Pe ochisctbn secord a a" caller: ow pointe, to hoxt record ‘ me, vohan 4 broadure, PF calls broadure, & he ackivation Yecord Por @ ond haw Be Vhs adjustable, sige darker ib pushud onto the Atack, toon @ -woturn ta retum addvess ty Jubched from the activ ahi secord. dhon thy achvaten vecord for Qi dhickiody weno ms atock by Joong - =/9 nee Stack, pointer do We activation record er Pp ( tommedbicd Dy bole Slack base! Amplimontetion “Ths &imb lost tun -hime Sto nygrnt Aithnigue to hard, activation vecorel ghtucture 1a Stack. ree gto at ~Vro start al He execution in seb ap Bhi 9 al k in mo te 's ablecal a seguenhak block in me , Oo & th alscater ik tk Aakon rom sequontial Rocatrons ie ha Akl, eK begining ot amr ere . Atoroge mux} ba qreeel 1h the reverse ordks ef aWeestis, Bo ‘thot a block of storage bhuing greed 1h alo agg ad he teh af lle Atal, A ginglt Stack pointe 1A natdeel +0) combo) wstorage a hacks tack _peinder alongs beints oct top ef Hh 3 ' ck, ald Blo rose in we Sies (nthe stack Tallow “the Soca on @rein's ty Black poinks, alt dree Scho rege Giex above the boinev- a hab Blom aved 1 ureel for stowege of other Aly nein xy allocated dota objects al wn tire. nernoay orgy) during execution 2 ey he Aotad cote | demporrrien Reha hon record a one proud rarno we orgs : Activetion tree *> we can we @ trepysepsheus /athe tonto! enters are! Leaves activations, Hus tee is callecl Activation tree. > each noda prosnts an activation al a ipweedure, = We wo veproundts He activation oh moun PYOSramy o a gt at parent of node b igh the control glows frm a tov: wp the eda ov th Saft ts neds. We He Bietire of a. occurs Vaslere, Yeo Mefetiene of b ex> ener Yroun main enh Pp enley q Le exit q © anes 4 An rbd Alle) _ “f "4 Exit pros " 2ST. RARE I Aces b Nobel dole or Akelehen © Dishlays | C for shake Binding) Melon a Longuase hoo Ye cuvalve. procedure at may bossible Yok several aclivaken socord Joy We same block or procsduve. can opbsse rmudlaneooaly on Ye run Hme stack. on yethod for alc birdy of identitiey te nomed we wre “Ho most closed apted vals Mt Asp - ctr ron Ye Shack ol, ackvahon xecert| gerntain any vO° activabion vecorclt for o bleekk or \proceduye ve ty a Web \ pointes ca\les\ He dabley +h dishley ros a psioky yo “Yho rec a¢hvation Tecord for aver procecl uve. in dre ehotnment ef she currently achive R oerlth " @ Ste Stack of a= =a Pehiva tion a Yecord a dishloy Heab Mamgareck <- Cor dyramie binding) Rome, lang alleas yocurhive procedure cals and Wes Sent bind 4 tdontfierd to romes: sie vals B- a veferen@ to Om \dontifier Fee do Yeo most ‘vecont! \nitated active choclerahion ee uy a trond dant fier : example dex clisblay o fonsiclux progam qrognent i procedure moin) procduve P (aD proadure Q(b) Ls RUD) end Oj bes Oca encl P@) procadure ROCA end R) Bs Pca, L# Re u ws LS i Main), pisPLAu{2] pisrlns o DISPLAY ee oon wecord Soy each \proceduy-e containso} < of oll tts decagr ed identifier , we. may Acatrch won bh dstack Sey the topmost recovel how! Dalat. for Aye dusized identifier, bud i} is time consuming : Heap | abtecotion Ib o worded asun- time agg) 5 Volos, vobue p Sr format a} Reltvation Recor :— fn activation record in allecated “whan @ procure ip entered and ‘hak auulatiecctted gohse that promolure_ exit qctuol baramaley peyes (4) Yetun value “ The yelumesl vole o} the calleo! procedure. is ychurmeol in Wis Yield! to the calling procduye » ( generally & mocking Yor Inter We Used for Hs bintpo-se- Acloal parameterk 1 He Bild foy actual prametes iy eyed by the, calling pradwe. 4 ubbly paraakr fo “the “conlNeol Pree obHeral Comba! Link: M@ We dpHorah contol link peints +o the achvedion vecsrd a tk caller - obhional Access Unk: The. cpioned caye link lp taxed to vofer, 40 nemles/ clade halel in other achvabon) re corda - Zaves\ machine Atectus'— This Jielal hol dee ys albseln ste Stechay the aching, lagtove. ho breaduve, Is calleol« ocal Oot ; ad 7 dick! holes dot Local +o an execiehon of Qa froceclure » Tem borrmies :- THis ted Gntainy Ye Fanfare vabahhy | =. prosram Metin } procure b = proceolure 4 re pees (419 Vorsiable Acopar &- | tho Aare yarabk name con be useol In the olvfferent | boasts o tre program. Whe tobe ule a He Jonguoge determine which clechanation eo name abblios when the name appear in a broqiam. > The occurence of a varabh 1s local 14 he occuren an A in the Aare procure in tchich thot hare Vs declared . Se ts dechnecl outsole fp Hod froceclare Hun eH a calls) rom leead variodl, a) procure P —, ver Biyd] A 't prececlure ps PVA 'P" var at Integy - begin Atel, bt er ene) fegus (44a) Scoping ¢— DBletie—eeope viel; Considee “He eevee 1 Wu 2 bre gram L ) an atatic rule He Gar "4 che vinelirg of procedure. nar a eo” occurgh to duclaradion can be wonte Jan (yn) olena Breticoly ak compile end she. Prouduve Dy) Sn dynamic Bcopainy— vn . chars the bivdiy prudure are noid a occuvhs te “declradbns teem wo: done deyroarnl colt at van ti oval Bh pd ne aL’ } be %4 i e Rosult !— Suhel’ co. cope x ib z dh namic Acopes- re b iis) Com PIER DESIGN DNiT- + ERROR NETECTION AND RECOVERY 3~ ‘hile date ching an erroy 0 We Pateer should be able +o give an erry Mess 2) a ghouls recoves “hal errr cove, and it should be ably to comtinue He passing wolth dhe vet of SIP - Srvor Recovers} hechniguas’ - @ Evora con be catagones as- D Lexie row © encounter a chau 2 Syntactic errors ( unbalonudl paranker> | a » Bervantic. erroes ( ufidh clared oF rnutliplackclare rdentifie. 4) Logical enror- ¢ Snfinte lech) Co as yf good compre pe errer handlerig ¢- 0 Detect tre preenee ef errs anol produce maanirgfal s mensege.. 4) To ‘recover quick! ; xr hand tiny Gmporants shouted rot aignti cantly dlew down te com pi lation al Ayrtactically Csxvect program, Progr aces wahich id not inte bogna Fite) 0 Exroy Recover Strate ies ‘_ Exvor mreceNany ec hig ines ant — D Panic Mode exroy mecedins D Pheare avd exvor “recone 4 “Exyox Production A) Blpbat Grrection 1) Panic Mock Lrrov Recover en Bn panic mode exvor recovery , apih sib all the i aymbals url a Aynche niging selon ( fourd.. Seyederremerererealaliani> HX) Phone bevel error eb very gl esale cls {ilteol voith ¢ Exch em| py poy thy bothing pointes toa specific exvor -voutine fo ake care Yel error cone 8) Exrev production ¢— Can augrnorrt the Grammar. ccith productions ~bher} gersrate erroneous cowshuct > rh on ona produchon Wb areal fee Poresey, We Can senate oO a at tye oP eke, mate eT TTT anata change \y frowns ng > Word se di 4) Global Cowrecthon f- ideally 1 compile Ahoulal trek Bnwwed 1p, We have bo globally analyan dhe Slp fo oposive and torts why hok Brol ervey), , pub St th Qu shpelate A/a) Teta uaedls Saar Re iy LR Resin e Ay LR yames will detect an error when HH consulh He Fousing acken —bbla ond gins an esrer ewhy . BR canonical LR paw will not moka any eduction loahore ahnouncivy an exer SLR and LALR bared rake mevered, reductions balove but vill rover Shift an Smnouncing an CRYO, onto He sh, Qkrneous SIP Bymbol WBhanic mode exvoY Rcovery - @ > Loan clown the shack until a sete + with a goto on a farticalrernonaterminal Ay 4% Burd. > Arca Sip Symbols until a ays als found) C symbol a & “fn Pouowta); but tus rely rot pork, fr all Sitvations) > The pave Blacks $e con termival "A oval alte. _ goto La,A] , anol vesume pandiigg - phase Nevdl exror YeCovEny o_ © 3 Each . ew! entry yn “Khe achon ebho VN “raked with a Apecific error Voutihe £ qe bo error hot tre Weir > Br exvor woutin 2 \y “Wot Cour - em Sikely walt me fregya (4ne) Srver Recovery in LR parser- { phowsse bhvore bweul ) Bone exor yeulines are - C Missing operand ) elie The veut Ip called from plata o, 2,4 255 j ay operand | ew tehich cy bach We bagi e\, es or Sot fpaversineats - 8 Men eweny veuhing ts td onto +e Black ang cover id with stated. er! Wnbaleincsah sh*t av erthusis) toa 0,112, # LST on WD hp voubre ih Gilled horn Ble Wes Gr calles] Ge insect or J magnon dirdiny ex tight bere hthesis - th vemove ake rock Apher tho youll oy calleol aie Symbol ( wsht panne . Ba: Missing opers ey Hale yeuling jp called trom 41 -an ich oF Tasht bavedtinisis is “a pash + onto the stack and e4; Missing Baht \anethun's— uth a aight parerdthisis onte te Stack anol Cover VY} cork, giale 4. Conch Grammy E> Ete the LRO Nom aet tr ie ee E> Ere Ea EYE eae (4/14) Each Mg! | eve | te) [id I be- dale Ve 6 (ahon found inakaolef ober covey ‘ih worth stede 4 “N > ~, 4 hee Pee Tells hat — He paraey ay beets as ee ot ce in % vat Aymbol aftr dot (+) ty eitar E, id oy C. i re nut SIP ayo! is any opener Yhon fd taoli cartes, Yat iolanc Jey » Bb missy Rom Sip BMY: Coprewel) fre for miss operand Cet) Hus re error YOU! Dood be called to yosolue YHA erro: dabl Shue fee Bebe DoH be en psilt be Lo +3 7 él jo. ¥J oa \o$) 2 @ ‘4 pare frd > expec t. Her by jrolical D that tA Sle Ain ante penatos Ky. an unbhlonus! aisht vot ae oy Pavan (ei ov Ale aymbel bat are! VXKOK @roud be bhud in tabl Wy) for De Loo res fmilaxly all exer entry val] be dons botd § | & el 1 acc + i z re a= Ls 2 ea vi ae D> Reber ore 244 area és, =! pets 4 = @ ove + ids t ov) +44 F cel ¢ Aecept— Aementic Wrrd— se parrary Soura et Bemenhica ero are, undo closed rovnes anol tybee in com party’ bs Gey Kh fat Lime we encoun an undeclroracl mre we Yroke an enby Boy Yea rare in the Syme! sake, WYN abbr ale athiby tr er | A i bo) ten : ger dor conkg wrt 8 18 hye ely eee ts reaper to cerende | ~Exvor Yecovery in Precictive. parsing — An error may occur (ny Preclictive parshg - > Sj the egrninal, symbol on iu top sf adack dos not match with Whe current tp dyrloo] - > 93 +e cp of Black VW % non-der miro A, cawrernth se symbol tra ond passing table exh miAal & em phy. Panic mode Qxyor See S = Oy panic mods arvor yecove dKip ald ° ' the SIP Sambo ls until a ranch nnidig we bs “hed. a —> All He terminal symbols tm the follows Aer af & non-terminod con bo v2) Awe Ys ~Yrott Don- Jermmod a * sapehemnier a 1) to panda unrroctelad fox minol aynbols, the parrer- obs Phat unmatcleel terminal Ayn bel rom he Aack_ and Lk [puss an error msg iing> that the tnmadcheol Fermi nol bs ‘eer 1S ) fo forcla. emphy ants —> ab embly entriey « one marked as Aynch indlica’e. that the parey hsill kip all the IP aymbo bs unt] a Aym bo | in Ye dello set ay non darmira A which tb on the op of He 4 Jhon ths paer pil) pop tock non-Yerminal A from Une Stack, anol wesurn parse — p 4 aD Goncidey tha example - S» AbS\el< Ne a \cAd FeLiow(s> = [#3 Follow (AD = {bl} Gui- Owe Pesce ” = ceadlb an sie ep» | tek de ole de aa bh a>pos | $$ ceadb$ 8 > AbS er aab} A>q $ Sbe ceadb$ pochd Sb bd dsbahc ceadb¢ ¢ = 3 bbAaA eadbd exvor ted ec, ove alt S(p Until + “e sh mith nd at a4 mgt orcuy \ Cook bo Sida ¢sba A cib¢ ChoP Ay 4s abs <>Abs dsba dod SsbA abs aay ee bd $sba abt ua, bse e bt . s £ 4 acceps— $ $ Accept Phore Sovel exoyr ea’, ce Each evbly erty in We panning tbl fd dilleal sith & pinky -fo a bec ial exvoy ‘Youling Which vsill take cove, thot error Cot. Tho erroy youl “a of - Chovge inter+ oy 2 Sip symbo) fesys (41229 = input abpepwabe! ether mg — pop stems hom ~the prack : c> ve el > te! |e T > FT = ¥eT \¢ € => c&) \id we idt) * shack 7 - qe ida E> TE! ee Back dey tat dy TPT yy [pep aebsk mah fer ide Vike W betrerthabih qeria td +f i 1S r enabling /earnin “a = a 1 OE prmiaer $e wd 6s aT! hae mete met E> & * bes + +o¢ tee aoe pci? | ei Bo. ha $e 7 yd ommt EH e eto wd x a ‘ *? ¢ Zz consider He te Pe: gelation tab for A. Ce preceoleng 4 p4 ee FD < “ “i > po yelotion nadal/elto th er minal oF he sym bo) eh stack ond tHe next ole § f A i > A hordle rina) bog tart Sno prodauchon ©! AWs andl, om & aight stole. ; ad Reco vend ¢— 5 each empty entry in Sled Bk a pointer do an exor youling > dtc idm “He be Hed tances." fooks alike” tobich as pond side. ahd trie to secover dam Hel Considey “the above examble-> , (He hesys (4124) f

You might also like