Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
331 views
Complete Compiler Design Notes
Uploaded by
Tarun Jain
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Complete Compiler Design Notes (1) For Later
Download
Save
Save Complete Compiler Design Notes (1) For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
331 views
Complete Compiler Design Notes
Uploaded by
Tarun Jain
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Complete Compiler Design Notes (1) For Later
Carousel Previous
Carousel Next
Save
Save Complete Compiler Design Notes (1) For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 77
Search
Fullscreen
sre |_UnitNo. |LectureNo.] Faculty Subject Name | Subject Code [ Main Topics ; Unit-O1 2 Dueoducivw & Lexical Analy2oc, i) Asoublee BTA 18 wed) to conver Hao Asm berg to moadint. fogucg’: Tacepetet 8. Tk wall yead Hee measaye nt by Line: Ww eo ry 2 Tk WW vead He whole most dounmonl and atch Gowr | dhsuo leueole aural + Wit pyets Wiha vind 4 Hosta ogy nt ' vt ke Analysis oy _compilace, deals (0 pevlea) praiys 91 {J syutox Anatysis | i | hivad fl ctomntic Analysis)! Vhs { | (4) tnteamediale! toele qentcaler | ita Sl code cpliuirotion @ Machine ais generator i ' a oat oun vito Gong Bait is sequen iaihy? Wer trowlake cde & velain |! in Wyhoe propromey eae ra eoh The badground q Compu’ ja DEA BNDFAN J ypimal us ONE) GNF ' Main Ideas, Questions & Summary: Library | Website Ref.:-Tee g_cngier ; © Single Poss onper i @ Multi Faas Complier i i ln Singh Pass cong i | . ' reper the Yp is Nigh bs 2909 Lovie ord off et Ingugye: | gh Lev} pogsam vt at High Lav PLL sfempiie} > object Loryunye (tow Levy nN) => ° Fy Zn mulliifons Compu, Nigh levy Lonuaze Ys passed to mere Fhow one poas to gentiak the hugek Joupuage ‘Prouds K Programmi } Tn compile designe we wale He prion in HU. whidy 16 coy to undvestand - Tet programy cx feed 0 asoiy q tals opesali ng ayphm tonplle to 3th tagth ede» thot tow be 4 une by Hat mackding, «Ts, fa, knowey 0d tnpuoge q poussing Splen- 27 Shy language Peale}Trose | UnitNo. [Lecture w i reNo.| Faculty | Subject Name | Subject Code | Main Topics:- 7 one HLL +o awothoc HLL: ' ( 1 \ at i [RULT} —>[pegrounmw | [Has] ijn /e Loader | Linke 3 A Lfcker {inks dient objects file into a Single: BA ‘txeaurable pi. i ' 7 A Loadis Loads Hel Ryeuubable fis Into fhe muriny on Sede U+ |B) sexe jie > 4yecutoble cout cam be produced by compiling and } Mdig In ont chp. AD fyeuttable ple hoa © piurame -txlenvio fe (wsindaws) or Wo fuer “txkention (UNTX) - QeFH Myacne helevcery Compiloc & Snlocprel ov Compiler » Very Tuleguctoc ——— ee © conypiler B wads the He wlole | O Jueopreloc seals Tht prograne Progsamt , HUOSAAL: Line BY dine ® speed 4 tk conspites ‘ts high @ speed Q ie aioe ig Low: 5 @ Nunny yepubxeman la high: _ @ AN twos we splayed with, , tryoy Femoyal muasages +) i 8 compte OX Loge th size ® vemag reyuisereen 1s bw © cowinuows trowloteiny He rrsosoge uti) He dak Gssur 18 Wot vue: Bur toy dakeciow js easton thaw Compile © oper we Malle in ut uid a © compe bad Jaques 4 Ly aueple Boe Lyrae Cert ae GAL t Python » Per], Ruby! , cto m + aut Nok: Jovay is Compe op we ov i dori HePOORNIMA * Unit No. [Lecture No, Faculty [Subject Name [ Subject Code | Main Tonle : a ® Boctsh > capri jaa prow in whidy dumple Lanquogé “HA tol to teovslake more Complicated progranv whiny ‘is tw may hondbes nore complicated progvarw- Thee Wmplicaked popaw tm jurthov handle. even Me Complicaled program, and So Ow | = Tt takes He ating gp ol an ap 8 omg | accordingly « vohwy “the he dy nabo] 18 gound 5 then the trawition ow: | 5 A gihike automaton is a colledion oy S tuples (9.4, & 4H f & ¢ Finile Sch q alates i Et Finike Set 4 inpul Symbo| q, 2 Dailiol stode F 6 : Fina) dake Framai on fundiow in Ideas, Questions & Summary: [Library / Website Ref.:-KK Pinte oupomatouw * Fille autnmatan axe used secaginise patty + = > Tt tokes the _atsng y- Symbol. os_1p —B.chongta its spake __ —-acrdivgly » wohuw a a thou. ht __ trowibion—_pcwuxs A le_outomaton_is_edetion 5 ples 18.7.8.) 8: Finike Set oy _atabe Ty pile eg Dap atl |] ________— 82 treowaition_fanotd i fs Yo + tnifla)_sttate F_ Ping) Shale —*—Despuing cp ‘DEA uu 5 = [4 t 43 i Ls-fot} ! \ = lh} pefh} sl? 2_Tromition_diogsomy 2 2 z | ©) Og pe 5 @Trawailion Table - Prout” Shale _ ii a "9s as] bsonlo BoB) B}o)bTloxical Analyrr we 3]P SUE mrain tasks qy Lexica) Maly ds Vo read choxadac, (tare Ms thurts, Progromy » Qveap thunt Into Jeni pred 0 op a TeyUCNCE 4 foken In tach hayiw jin tho od tao pongo « Sonnet seiay J ioattenlc Ladca) 7 7 prow avaty ace f Pars Anotyick _| ie / |symel able. | HF token ke a pax conaiatirg Qo Jokan name anc Valuat (Bw patiour 1a aw discdplion 9 Ihe orm thal We BA lexina 18 a dequence q charader in the sow pogrom that matches The. patiexn jor @ token @ Pyar taprasios ve alychric seprsavialion Q ‘Longuage- 3° txarple RE Jor Tderuiiens Jetloc(lettoe [ digit )* RE yoo wl sbing ending wilh abb - 7 y ¥ tv am olphaber banic siymbols thaw | on optiane} attsibule lexis made foke + Rqular agra how dy JP} gy oxy = dy Ry et. dn —Xh‘ J lo, | Locturo: 4 =] Unit N tureNo.| Faculty [Subject Namo | Subject Gado | Main Toplow= perry uleve' dginihen qor Vout piesa iar Aetler, erdiy @ Rywlar dqiriffors {> Loo , kdttug La-z]/ [a2] / oo. ogvon) + Tk is. a prophic. veprourtatiow oy Rywlor ‘txprasin RE (albjc]- wen fe) te: Autos break etc. Q. uw t ° * 4 POPOL 0z 2. Wawih aw diag-vere yer Ydentigiow i
lox is a. tool Tegwlax, Lyprunias FF davai rg wv for box hols io seyorrrd to an lox Ionguaye ond He feof Hay $5 lox Comper Hay allow Ove ft spelyy 6 kical andy urge by dopa The Up woke Lericol Mroalyec® i eptiee ‘) Lex Spedpiatten, si Cons] - moa Fule ile 1) el f > —_ rest mei C stream sham Gc a: our ]? streams toh J Gwow Some Lex speaprali an pues Trpub te Hs le conpler & ben 4 * Lexical Anajyzet » Tt qorecale C Ue g Send fo C wpe, IF gmerole treatable UL to inpud sro & pneokea sirname q tka - [3] Tedoraton Rubs 11 7 Tn this Stila dedoxatin~ q variable & Wishart, }t abo Cotuish By sons. yu Axpreasfi 4 . er “venPoors > i ; jets Unit No, [Lecture No.| "Faculty sans} ‘Subject Code | Main Topics:- vt Hindude
ta He Amine PL 3-14 inka; , numaboo Lo-9] t opLt/*/-/a] +f 3 . a wehle “Scctioy 3 In this tech comaish | sequlax ee ns ule com be gvwe vol He correspon ding ahve . the beomsi How F & , fe os Ri Lactiow} Ri Laction’ fin Ladin? ont pursboo Uprintt (This is Number"): ic ' +h Dap otk pon J Prowdu. duo } 1 ) The proaduser oteatio~ Wwnbdve | the dyivsifia FU $H0 predcive. Hr prouclv may be syebred in qui paxtg the He dete } 2 ink main OL yyley ()5 2 ath 5 "| Main Ideas, Questions & Summarys ‘Library / Website Ref.:-> Ths. Aus ff dedaxaxtio or pnchions axe wopted $oSuth fo He Joyeyy-c pile - ‘ yin 1s a veuobie Y 8 jie Yy programmer aasign the ibihén yyin iy Said 40 the pols by dhol ple — yystext 3 Dr is a Hype q choxafuo * - caveat fo > yylony 2 or la vale tape Ta Poiiured to by yytok > yrepe 5 yeas dedoxather jndiey & mun Hype | dex yp mi polnts to the input file . Ue waive Ho doxine A chorovee ass Paton Hades Lobe} “1 pre gabe La] omy ler pom o-Z [a\-z] ong a 2 L\t\n]t iy ov) While Space i 1 HhTaine. = Facaty [Subject Nome [Subject Gode | Main Tories K Enos hemdling “in luca] Analyser 2% Whav tht ken pattowy dow nok makdy We pedi oj womalia? input, Ihe Lexicon} analyzer gots stuck and hoo Wewveo vom this stale +0 analyze Ho yenoing impur- Th dimple voods, o Yexica} Guy owes when a sequenie °Y Choracter does not makdy tho pattuwv fokuv - ° Ke at ‘ptcauy happena duning Yat treuulion 9 jrogrome > Typeo oy Lexical treuor D Exceeding Lagtly q fauntigion or numede Conoteml + @ Appearme q “ULegal characeg » @ Upmatt, shi ® Spulfng tT © Replacing a chorader with aw inunred” chaxacko: © Remoyo} oy charac thot shawd be proof 1 © tensposition oy 40 bing chaxachus. - |Main Ideas, Questions & Summary $$$Unt 02 + Review oy CFq Arabigully op psemmed Date_| UnitNo. |LectureNo.| Faculty | Subject Name | Subject Code | Main Topics:- Sots tee gundion cout A jumdim Out oy declaral ow A eeu ov aiaeto out of operation and so om: The Syntax oy programm rg Longuage combat conkxt Pree gramm Oc: A> & This ‘orprensiw 18 called Bakex -Norr ge" ” Gtommen opt. Sigeificoml i : L> A Grammar give predse yet tay to undustand aynbtlic Spedpcahey. foe a pogrammite Lompuaye, Pelaases oy Crammee From Coctoiny clansed G grammer D> We caw Consburch mene ogitot paxsuc that deouming Yat Syntace dba chet o owe Progr ont: ambiguity © bresble aicoune thot wight have stippel though the inihi of P dwign phone ] the Language 2 ap ; Thesbuduxe Wpatadt fo a Lovquaee to be, evolved OF dueloped iteratively” by addig nu ondbarce to pergw nem tothe ' | Aa site benefit, He Paroor qovobuchion froaas caw seca rove] a 41% | f Main Ideas, Questions & Summary: Library / Website Ref.:-} whic is wased [or gretatig Syment onalyzex SS Parsee bd a Compiler qonveality Juv Pane tree. whith Is fiypuk fe Whe FH Role oy Parser = source poopront wwhidy rs ap fo the Lexical Analyzer + The. poxuy, obtain] stig cy fokura from the Wracal epalyZou ond veupien that the dung con he gramme pene Ov Jae Apwoe Longuaye Trtamudiole Code. Tokuw SOULE Tora] far q front thd jaulsyzec| Tr dueds and repeat ay Syntae eseuns and produces a pawe bee from which intoumedale code com be genecated» .@ Trew ase Hoce type q Parser © Vniversa] Power! Pewupel by cocks -Yourgey hoses) Cinapiued) uses © Top-Down Paxsec Recursive decent Pouer — Non- Reussive Psedidive power => LLL) Powertaie_| UnitNo. [LocturoNo.] Focully [Subject ame | Suboet God | Waln Topless (3) Bottom -vp Taser. — Ahi Redux Parser > spray Procediue Pawor > Move qpided Rae, SLR (simple Lyt Rewaive) CLR Carnonicol byt Recuive) LALR Cunfe ahead Lepr Rewsts) ve) PK Remove tho Ambiguily in CRG Ei) south ine, S>5ts]sasla 0 ® . J) sts Lay WN YN \ AL a @ fi a a + Tp He ansociolivity 18 IY fo 7b then voe have to promph a, lath seusion in tho production + Tt Porat free voll! ao be Let yeuwuir Gnd gro on the Lepr Sida 45% 1 / one At associahive Cpepeders: Aigo vipht casdahve spear: Main Ideas, Questions & Summary: Library / Website Ref.:- —(2) Precedene Problem sostT]T OR oll Jorte/F oT. ' Fo a uA Te | Lo | a a» gon & F —erefe-efere/e/t/ ©) [idestyios ZAIN "9 E apart 1/7 roe] Tes E> (©) /idestiiow 1 HK let Reawssive Grammer, ; SA Gromer ig not TawoWe |p it hod o non-rwvdive O, Such thar Hholxe i dexivaliow : AZ=>AY AS tp-dowh comuet handel lept veewratore- fore RewWulve qrommax., ed thot beaypmmatiow is needed , to Nae Lat seul ow x A produchow 9 => Aman =) AXS =D Retortpate [ Unite. = Faculty | Subjoct Name | Subject Goa | Main Topics a [aoale] soe A>pA [ieee tv A AX wp le=> Te —= \E> (Et DIT) aa Co eta Crammoe To TtF/F : Ofov removal FO (e) [id L Fo FT Let yewuion Tisepr|A ®© Genexal form Grommet [AAs] Ame] a) ee By] By -- - - P, | po Bea] = Pod No A ya /- Xn Al A Main Ideas, Questions & Summary.———————"JJ[J_> brary | Website Ref _Sehalb > s—sda |b Am Acfsd]A 2 Am Ac] Aad /b4 Th above Jrommer Mheix is indixech byf seuwaien > “sobs s'das'|§ A> bd a" Jn At catfod at/a WK yt Fattesi ng > This a Grammer that is uaqul Jov. produces a grammex cluitahe jo prdivive ov top-down pouce A Grammee 4 Jom : A> 8fi | Pa! \ v a “AN Bi Raf Rf =e a By| ‘Date Unit No. Lecture No, Faculty | Subject Name | Subject Code ‘Main Topies:- bs Ue Ss leksy jctses | 4 3 math they tw hb y ae Shall Lomb y svidts st [a si es] A cab & Remove the yt founig & lyr veuraior in following. Grommen- W s—s4s] ss] @)/s*/a WW sm s(s)s/a WD) ssashs |bsas [a * Top-down Posing . “Top down porter con be Viewed ad the Poblem oY combudthe o pare be shoxting jem the wt & Creaking Hoe Mode g the parse fre in Prevdery tyuvialunly top dowh passing com be Vioed 2 ithding a Jat must devotion fw an input ang. ETE! E> tTEYA TPT TERT /A F> (e)/f 2 24 ys (®/t4 [am = gt tid | ; Main Ideas, Questions & Summary: Library / Website Ref.:- —\ 3f\, = yah Se ‘ : ‘, / SN vy ON ® ; ih | i | 6 . © E \ Pe Nu E 7 a {ye as ORL | | /\* ia won E* i PNr { ' © 8a iq * Algnitha void AC) D chase a A production A X) X2- as © jw (i<1 to k) ® CX Is ow pone -teirina) ) : ok Call proudwu OCs © igi Gua He convoch JP sypb] a) ¢ advance Ht Input to He owt symbor @) CE I om enw has Oceured x/[> At Each skp oy @ fop-down pare kay problem 18 that 9 ddcawiniy the predidion to be dpplicd {or @ mh -jounng) doy { } | | ® Backtarkirg g cAd | | | A= abla We ca 5 6 3 | $— cAd / \, A> abla a ) rs \ batho This prowus 14 krawon ap backhackig.. | “Backinoching ix bot yin K Predivive Passing 2 A spin) cane Pasig wohen ro baualeg ax reyubee Prelit pouring che the Gnvett "A ‘podut~Luoking ahead oF Hel dp 4 pire Wo-7y Yorba S The dag prommur qr hid wwe cow tonbbaucl king A symubo} ohtog put the IP is Sorhinws couc| wep) Frames # fev conatuuctirg predddive partes of LLP) parser, # - Shr Constusting pce pouey or LLL fae, ov Sond tay MP Pawve bie hove fo compuke, Hh fuedt anol parica \“Ke Mow fo Coladale Figst _¢ FOLD _% al Gramm ees ep (ys Prat Cx {) = 4 whoa & 14 ony oy Abin % avy ME grommov Jo tee aed 4 Jeane} that begin Shika denivec| & A>, CY hres (x) = Faeat Coy) = Fer a preview how jeal cm be wed dui pcea}p — whow Suat(y) of Foat (B) ant dubiny Soh <5 To Conepoke PIRST OX) oy old Grammer 5 Applying Hee following ub O yx is damina) , tke FIRST (xX) ={x}. “A Aa Frest(a) > @ ® Yy x js a hon fotos, and given XY - Ky FIRST (x) = First (Yj) () Y XoA Then odd Yuk) Aken, FIRST (x) =A. ! dps epinnel eter ameliNs Tory Thee FT i/A F(c)) td : “ #3) pepst Ce) = PERSTCT) > PaRsT(F) = FBC sid J pest (tl) 2 [404A J aus ok sod Us , Fiest (1') =f #9 AQCPoorna, a pate | UnitNo. [Lecture No, Faculty | Subject Namo ‘Subject Code | Main Topies:- — Fror yoklow (A) fo be st 6]. teawinals ‘a" thot can oppear Immediakely to tha TYWE g @ fey dome ontnHal erm. a> cy S* > vAof To compute, follows (a) TY S iach gymbol thin Tndude O$3 ir TY thd is a produuion A+ a’6p then ecdkiy fn fear (8) accept NULL: — Follow (B) = Fiat CB) > Ty show 1s a podutiow |p YAN Foto (B) < Foltow (A) we 409 ponow (E) = [4 +)) Fouow (t!) = Fouww Ce)= 0F 97 _ Follow(T) = @ Fiastce')= E+ JF 2. Follow (T') = fF FF Follow GF) = f*i +>), $ 3 Main Ideas, Questions & Summarys brary / Website Ref —Hodel g Predicive Poxsue ¥ @® How fo make a pouting table - 2 7 ‘ Tp_Symbe ; ard om rood Tp Syrnbo] ai : T oT : wT: jay OCS afd f+ | | Cf) § E E>TE! E> ye! len < E' E!->4TE| EIA eT, pt [rrr Ja FT! —_—— t fia ater’ Ton [TOA lee | | =(E : F ) | F-(e) | [Date, | UnitNo. |LectureNo.| Faculty nn a Main Topics:- @ Fer cath production Aad gQ He grammer do He plinwing’ For-seath: uvaina] A inginsT(x) odd Ax tp MC hia}: © WY WA's, Bim ELRsT(X) yteen yor” coth fenthal. In FoLOW(A) add Aso to MAb]. UAB Ip FIRST (a) and $.15 in FOLLOW (A). odd fa to MLAs J on, woul; / » oO tiated 9198 So saicrss'far | 4 simes]n i ’ : : c—4 a “PS parst(s) =[ia 4, Furst (s') = Lea? FIRSTCC) = Lb} a FoLtow(s) ¥ f $ eral] y Eo > *inideas, Questions & Summary: \2ary / Website Rote aPE LLY Gamer > Th foot Lin LLG) gramme shards for aeneirg HO TIP [14 det +0 wight: The adeon dL yw rodntive Ist pest aemiphion Vand fw Wing Wt tok ahead yo no 4 IMP synthe) ju bee edited 7A Grammer id 1.4) ig vohonene hoe fp’ a : Foy hof kuominal gq, ty both 4% % fe delice At mop 4 | : Y lbh uM duin jy i & Yu Poa We down't duive gy shyyee The Heminaloluw(aje ene hates witlv utilis beginsig with a. eso ee SAb oa in hn UP Pidker Poth Cysmponds to He unbustn~’ 4 Reduction 8 Monde Pardes oxe Hee texdulaber os B woking up tuwds te wok (fap). © Reduction : _ 5 1 = >A town yedudion! dep a -specipic Aubshirg robb Hs bidy o a prbudior 5 nplated by rn~torsina) of Ha baad & thot poduttian « @ Handle Pamir iy duldrov Batten up possi iy useeg Ba Peres rg A orebutr 0 nigh wast duivatiov In rune Can be obtained by handle Pravin .pato_[» UnitNo, [Locture No] Faculty [Subject Name | Subject Code | Main Topics:- > Ik is th Jom g boltomup porary in whith tack hold Grammer Syrebo} and aw fispul buyers hele the , yesh Fe Stalrg to be posed - Handle always appears of the top g the Lach: ochualyy 4 possi ; SW) ible auiove - OME @ tase” @ acaph @ tovor nae the nyt HP symbol dite He top q Ho eux. & Redurs 8 Tr vight Sd oy He Stang Would) be Add He op Hhe eth: redu mut be {a Aceph + Announee Sucespul Compltiony Q Ponsivg (Error ¢ Diswver a Syntox exor 6 call an Oro7 vecnventy yo Lin” al Nain Ideas, Questions & Summary: Ubrary | Website Ref.i- BE >EtT/T. © Reducing Podsti, TOTTEIF, id ido pe (e)fidy To 7 FR ie THF \ +944, F= id TtR Tree ‘ E Wr Shi Rew PosnerSS Input AcHiay There is rylick blew wha | ady tid gf ahyt to shay} 4 oF taken 40 aeduce Foi Ted. Ts, ts kaw ad, , paluce TP TAWIEES Yea Conglidh! shy Soy Thee! are LR Rasen | aayh Gingic LR) be SLR yuluce FAI pole Totp ® The wwosk provatent HPC | $T vedue CT ° bottom up pease hdl be, aueeph 'S bored om a Concept Colixd —LR(K) Paxsoy ‘LL ges lyt to Rig ‘Ri gor wight vost doived 9 Kady k= 4 t : tut feat bap aft 3 Simple LR La rani’ Je Tnixoaudiony fo LR Passing + Shwple LR is 5 The wost prevelant type o boltorn - up pads todayy is bared enw concpt Calls) LOK) paokay « Hhe ML" va gor lyk te gt, seamed g ts Trp, the "RY ger Conatenchig” 0 siphtmost dexi vaio in TUBE» and He ke for the niunabow % input Syrebols q24 Skabeod thob ont Wd'In maki pote dedsforys |” ® WHY Le Paxsexs 2 ee LR parses com be Gnibuickd to Tetnpwize. virtually all popomnttng, Sorguoye Gwabuids 4° whicly conlext- free yrommaxs com be walfen.pate_| UnitNo. [Lecture No.| Faculty | Subject Name | Subject Code | Main Topics:- > The LR ~ parsing mathod is thw wwsh geno] pon baudrackiig Alyph Medue pausing walhod Knowl — The LR porius con be det a Sypokau CWT OF SHUN Of it ix possible todo so on a Jat fo aget Stan |] Us. bpufs — Th dlavs GY grommets that com be parsed wang. LR pthnds ja & Proper, awpoucl q the dass q grammes thot cum be paued with predidion oy LL asthe dd “the pincipal drawback q He tod is thal ir P is tuo rh vols 40 Combucr an LR pawee by hond fey O typo Prjrommii| FH LR ond Us (0) qutomatiowy Th LR(v) Lhe fv a grommor G is o produdhu ty G with @doF abso posiHove Gp He body. Hw jrodudion APE | Poduas 4 ‘Udw- Am °X¥Z 7 Ao KZ A? XYZ hoe A XYZ" A> XYZ inditabes thar We hove just ce On He Tapu- a atu deeivable jen. X and thof we hope next 40 dee a dking douvable prow YZ. Tit A> x2" indicated tho we have seen ths. body XYZ and that ‘Ur bay be bine to reduce x¥2 tO A. Main Ideas, Questions & Summary: wut Library / Website Ref.:- Q-= Suqwuted Cromer 9 ~ 4 Gica Pomme vat} sia symbol sa then Gi be the Auqnadd q, ' Grommex wilh Start Ayrsho) ro) be eS sos Rev coling LR(o) Uw we have fo find & Clantuxe g He Lene X Apply Jeto fondiony | * Closunc oy the ‘ow, > y Vis Q ot q Tong ge prammce G hen chose L Is asda, Taw Cons bated hy following wo vulea- D Ditiaky Add trey ‘um 1 to closun (1) @ iE How is a poducdion @ A746 p is dhe dust (1) ond BOY 18 podudie ' Yhon Add fu ikem Boy % closwx@ Ls Apply his rule Uf WO mane lene com’ be * aclded to cose 1 * goto yondiow got (1.x) OY AcxeXp in Ly Hen tM (wo (1x) in AYP HiT 8 gsett|T aot] F p> (ed) igDate] UnitNo. [Lecture No. Faculty Subject Name | Subject Code | a Tories | Augmanted Gromumnvu E'—*E, Es EtT/T TOT EF F -() /id Closuxe the Rew 13 feel f, +f e'— "= F> +(e) /id IT, = GoTo Uo 16) E> Ee ECEtT GoTo (Jo »F) Tor: Ig = Main Ideas, Questions & Summary: Library / Website Ref.:- E> 2E+T|*T ToT RE JF 1, + Goto (oT) E> T- Tote F Ty, + GoTo( Ler ) F> (+e) EE+T E> *7 Tope T> Pls Fo +(e) | -idae ts a do | ine | | Tat ToTtE F> CE)" s KT LR Pawing Alyoritony SS ee > The ademakic Gon LR power 1a shown below + Lk conisht SE aM Tapa, on oupul, a shack , a driven progromy , and a Powing todle thar has +00 pats (ACTION 8 GOTO). The driyoo Program is He Some fey oll LR Pouce 5 Only He paxstig “table chonges prom ont power to omothor | The dhack holds a dequen @ YY Stolen pest -- Sin whee Sin %5 by hop. oO Oyf a |... ] 6 Qh f Tn Hris SLR mao : The cttook holds atholes qrum The LR(O) awhmabon- The Comowical LR &LALR mubods aye ind low « Mode] q by LR pateDete_|_UMENa [Lectre Na] _Facuty [Soest Name | Subject Gade | Nan Topise™ | | ot ® 1 CombarcHows G LR paxsig Fable Action () take as aguments a stake Land a deaninal aa ACTION Lisa] i UY Sy Gyr shak Sj ) DEAS. — (veduce) and Wo behkeuninal A de Slobeg ‘ $$ ~ ~ SF accept + He pawee acceph He Jp and finish pasoly 4) Exot ¥ Metod 2 © cemtuch c= [ToT bl accep ex. % i: EOEtT Ri ECT Gi ToTtr % i TSF %: FACE) a ee ® Ty qote (tea = Ty hen ge fe maps a dake Le Oak A>a&:QB and Goto (Ti 5a) = ACTION Li,a] +o Sj Axe is ID Ti then ach ACTIONL iva] to A> whan @ ig in Follow (A) YY sos isin Tp otk awk action Gf) is Main Ideas, Questions & Summary: brary / Website Ref.:- then Xe r |® same ad LR(0) Parsing - The only * Lowteding SLR -pocsing Tables 3 SLR) @ siru) rys to STruple LR Past dig is th He pouing fable - ® To combud: SLR fable we cnonical op LR (0) Ie. ® WD SLR fable, plaw He wwe move the follow gq yt hand aii. * SLR(1) table ® Yo Hale bh ia py +o a move ‘if Corresponds em. A= - 0A] qh 4o Some other Stale on a kedwino) thaw im fw adive poxr- - @® Yo sok Th going fn iiniad othex sthabe. cil a totable (Non - Heuninal ) than’ 4 GOTO pane): pw} if Contespondfig to qo fo nove ind [
ab- whidy haa no frowilionn to Ihe voc slole thin Hy padudjon 18 known ad seduce prodadjon {7 0 Juominald YX 1h FOLLOW (A) Wile the reduce entay along vob thee Produ diun Numbucs- SE ESEST|T To Tt /F Fo id skep-O* Add Augmert produdion & Insect 's "symbo] at Ho fouw position py tvou productohd In q- SSE E> E+T ET To TtE TOF F— sid (0) SS Drow tho DFA dowe oo LR Hep~ alep-6) DFA ‘Pind FIRST & FOLLOW of vapedive Non -Teasinala- aa prpst CE) = FERST (a) = FiRst(F) =Cid 3 PooW CE) = FIRST (+t) ULES = Eto Fowl (T) arenk UPIRST(E) Main Ideas, Questions & Summary Ubrary / Website Ref.i= aterFouoy (ry = ft $3 Sep-@? Fox Oueph UL Contam Ihe gine Hen te and Foun (s) = {43 = Acepk Indy dons. SE? Bo adion { us} Skp-Q = Apply Goto port amd sizer F ochon part - C Both art donc of Lr(e)) Skp-© * Poy seu in Adium pat ® Maks I,.3/Ty, Ty Ble or © Define a rwmbee to HS production EoEtT —®O Ce ton) zo TTF 8 Tor —@ roid : e TT [gars | Adiow qu to dd |+ | * gle] T mo AS i] ea 3 Bel Ss Accept yin di Ri | Se |, Ro kk Ry | Ry] Ry af a Ro [ Rs | Rs ust ra iG Ry | Se | 2 & & [Re | Rt- = ke cur Saxatr LR Rede fa counbice Luyokolweo| UR parsitag Lue fae. cancel cou) ellen op 124) Serato bull — | Mo —ciR WL) Parsiisg fable.» i -LeLR.L) Posating anil tne natu slalea-00-taspon— to -SLRCL)_ te —Hexe the secu ue frods_Diabyy—tnn_Hst ne aheor|_sSiysbols-———£§£- | RU) Shem tao tated —g 12) Theat onda lkalund_ dys | RU) jJem = 1R(0) Them + lank ahood)| Nolet Boly ote tome od SLR ond tR(0). Q@\__ for Reduce yon LS Hoe fino} Hern uals alrfves | _____ A> 4: Cony so cc t So, -odiow [ty.0} 2. Ty.4} =k, | pet c= 4iq —coninint_ ra iim 7 s= con 805 coo Ch. baw S84 ,s0_odion (4p .h) = Ty contains jira} item 0 0 oC + cid 180 odion [teia}=ftpbb =R ty aa = A> aAh-$ _ { t5,$3= i AcHow GoTo states es s & IL. To $3_| 84 1 R | oat Aceph | tn Sg_| §F S | I3 $3] Sy % \ ow AS [RS 1 ; RL. iL tc lt sé | St g Lb [as] ae a iy \ Ro TLALR CY FLALR fefen to the Menkcahsad LR dn Lace Ponsing Ate Leer) item Which. have Same Prectuction toh difrent Lose adneacl are danpinaa tn % Single Set Lem, - LALR C1) Panriny A Same Ay see CLEC ery , Only dafferente tr the Parring- Lerlpte. ALR stakes Th S's if S3-aa,f Ax.an, a/b Ay.b, a/bto Cp» Ze © 67254 dg toto Ct.) po aA, afb asa, lb Ay+b y alb ha ho te Cite, b) As by ab Feo Ge Ch 6) ssaned Ipo tate (Lo, V poand 3 amet Oot Tq Got hb) pobe ogg, tote CIs,A) Asanyelb a> Gees (16,6) Ax an-¢t[now Stoke Ta and Te ae cawe jn Galas pet dilfen tre Lreteatend, So ise Com Oyun Jplem amd called ao eg “186 = Ax a-a, aftf} AS an, afb/f A» .b, afbld tole TH and T7 ane same tn theh LeCo? bule COLMA Cowie in hain Lyk aluad, so Wwe dam aol Called! a4 Ear, Ths > Aawb:, a/b/4 ale Tg and Fg ae Same th Haein LRCO? bot dif. Men, clans, Ghai, S6% a chr Geblue hi dt qulled an Tso T3834 AzaA: a/o/fae f LAtRei)Gabel 7 freaticha fering tebe: * He & Prammar 4, a Fr ts Paving deWe [4 Peed? Fev eauls paddle, xs 1) fer exch terminal a tk Fo) td Ane b MTA), a & 4m Fresths.) jlew fe exe terminal b in Follaacay, al nak REMI. Woe oan FRITH) of f G iw Fellbbo(a) add Aap MCA, Je well Gx4 i tho tande. ia ova. inkesios mode + treet ase monaly addi Horner welds qa the node haa dnildrew iin Has Syinkaye frees __ Tt i | gt Comatini ches —fumcHiow, Node toke. funn of mune oxpimnersts | i] . . | | nnd Coy eee | field bh emd_k additional) pields fr tho _Kc clatldlrea, Gyro Oy | 1 | Producto | Semowtic Rules @ lett T | Eawnde = nad Node (t's Eysinods , Tonods) | @)e>£y-T | ee node = nen = « © @| pr E+ node = Thode | @) = Ce) | Tenode = Fenda. | ©| t=fa Te node = nis Leap Cid, ie einbary) = T= hum | T oodk = nen Leof (nun, rune val) $$ [ ° : tobias Sith trees fee Sims ea prtssioe $= 4' 8x! eBatente ayntax Apte jor, Wicd ven L an => Aleps_jor Coa buch Synbox. bree. Tags oh ue = nue Leay Cif penbuy a) 3 —— 2 P= seo -Leng-Cohirm., YG tn © P= nue Node Css) ppo Py at 7 “et: = nwo _teop Cid 5 enbuy = Os SW —Peae de oe Pa-r-Py} =
—ve g2Atbeibulee| Depinibionf ———_—— An Spb-i5_S=attribuke| ip toy _olkbabute 1s Synthesized < Sond_con_ be inmplementec| cuted _bobteion tye Leyenda aioe Ls00) ton jam iM obi bules Ques Best _(la3_o}_SDD_1a_S.= oft buted —aliyi piWfowas each abribule mouok be b Aysnthesized Tnheiled P tnhetbed ox Synthesized -obbibukts oxsoctiab title tis ——— Oe gee Le SYTruplementation oso ey = P SDT. ia inlomaniedby__conmbuscting a» porse hems] —_ | -pry-owurg.- the_acion 1 Jqt to sight—dapth bake = ———-v¢der (prs): pati eal a ea big oa 3 F SY : _ _ Po - 7\N i EFT : ; al = 5 a _ Fa’ t | ‘ YE air texvo} =Y F ali tiatos fe, Digit bxvel=3 Apne tree shauoing ti valus yi Te connotoled parse tee fhe olbubuteo pl situa athihuke cam eg tat pen — A synthesized —othbubea of moda nN is_dipineol_ ond: ip_toums_oolhibute volo ot the children ‘N-ond_o Al-ilse- a Aw_inhexited—alin bul-e_of node N_is_designsd oly [Hn_teuas_9-olinbutea_value sof NI'S_porent, ‘od 4 bselg nits Sa bling. :oveny_altmbule ts Ss “synthesized j}49.a__om._SDT_18_caltec| —S-__— _|)_pymbuted SDT — a | a are _othibule is Syuthasized y the volur_6_paxent—nods——— depend spol jdoo _Volre y deud—node+ _ tt has = pthibuked “sp7_ia_evalualing ety p_baHona up parsing -— ne gone pa 9 -Pns el ties co _action+—> DAG provides ayes woy to delumunt— Texas ) tub. Aupee/s10b a a —_ ee ee “TAC Cimnee_ added inde) — a a AN aS ST a ~Aly ger ceutncdion. qa A — —_— — fa eon £49 peunioms ___©._|x:=yopz a. ey =(ptit t) pee * ees = pay @ = py] doe yt te Ea odie . x czy] ® Tat we Shi = ky if peo ak = ae aye Stat Curale tnnclo ( =e ib case): thon oreale node _Coptioter) ) ohose aly { ed ta no A) yt aly is wade ty) = An_ coe (2) Chsuku Wheto Thur ts_node_Copucater) with chug 4b hada (y,)-- | +fTey ede (x) will be toude(y) ea azo *(b=0) + (b-¢)* 4 — — —_— pe t, = b-c - - + Sa _ ty) = oe ty ty = 0 y be pyr: @ Oo. - as + Pwduchon Sementic Rule — E>EtT = : = + £: enon E>E-T Espods = hew Node Cl=!, Esnode, T+ node). T= (fe) = E node = T-hode Tow Tenoclo = E+ node [}_ $s sein eg nien ee ay. O Co+b) +Corb) Q__atb+a0+b — Lops) (Caf #4) jarirt —> __ It Paxsex, [—=[stalic acer} — Taicemedake code poneroley | ———Stolit_chadang —tnduided Hype —Cht chi batalla ch QWdLUKCL Wh. ok _opucerhoss _cse_applite} to _coiaspa i ble —— —_______pptriomds Tk alvo—_Induides_onay sot C_che dt _Hocik ——§ stun. Olln—a}rou pursing Heed _odebress Cod Sr ened — pane genenoleg takes a ———yeneca|_ earn fs = yop 74 I fy t= | Friplen ZR ort [ 3) & = -C I )_ty= b™ ka| | x++5. (TAC) 0 yjCa b) gato 3 ® qoto 5. @_4,= xt @ xs=ty ©_exit ty Cazb) How + at (rac) Oy Coch) gato 3 eLae. @® goto _S Qty t= tt @_asaty , stot @_t 2 = r-1 @_xi=t , plod @_ exit@ | une no — “Excel () gorC ists fe=205 TH+) do KLSHtLO oo Fre addrens wde (Tac) Q the txprasion - Y ien5 7 , 3 ipCiceto) gto BE awe H)E coe Li att 3 % gobs brok ; 4) t=xt40 Fie ? uh care 2+ bets 6) teint mh %) izt. goo a j : Y bir BI" ID 14 (ch==1) goto @y cxo Oyld=-2) goto dof ® ty=a+) Cty 9) Q=t) goko # S whit (c<10)5 © teb4) SID 4) cx0 © yet. ploe Y £ecrh © wit 3) ot YJ ypCe< so) gor S} ptt: s = Main Ideas, Questions & Summary: Library / Website Ref.:- Date Faculty | Subject Name | Subject code | Main Topics = = DY 3 sttosaye Oxgomisotinw * 2 The txccuthig taxget program sun in THs Anglcal asdeos pact in which eady proyrom vatst hoo value “The money” & ergori= ZaHion OTs Magical Spat is Shoxedl witb Compiler » opsreiting lyakrnd omd toxyek machines: The DS match He bogica) odd: fo phuysicad ade» tolida exe Wotrally Syprcoud) Hrrough ‘monuny ' The um tine rprauntaHon Om thfed in the Legical auldreng Consist ty doje. progvanm . Typica) Sub division GY FH He \whd wet amd dota axa aa thown bows isaHfon © ctisotegin > Static Allocation > Tr is pr the a date, aaa Object jor compile Hime: the dive oF dotw Objects is bwwn for Wormpllee Hyre & HO binding te date object home ond omdunt sane — do not change a UM hime At Compile tine cornplie com JU) He Hee dato. fs operale. oneLiniberbiw rane only THY AIF 9 oro objey be dont ‘ The dtabic altocalon Ca? re dunt = 1% awwon ag lompule ome Reqaursive PO hwo Oe seappoley QJ Yan Needa_to monn _wareg? . Adyoulare © — Tt Heals to Jookert excauivn preci — Tb povide the mut apicieney mt, other Hoo aca adarj, J maximize o wWilizalien QB orm U axinize ou lz g au tt opposite ends 9 ond hap ax ob te opps) Je Tmoaindve the addres apor: There axcas axe dyanamic ond thw. Yze con charge ao He pogrom txtade- Th practice » Ie shade gone tO lower adder amd Ineap yeh dugher adhe ' An attivebion veeord 1S used, 40 Shaye aes yor above, Hh Soh % fee maune: ari: LJken Gortno) reuap fo Ihe calla dhe oulivation io. fhe celts prowl.» Low be seshuuwrtd , offer Yestaute the ‘voluse sdavot suislow an dalhing programy Goutou }o He pox immediate Offvr He Col: , mor propromret alyws spoyrom fo ahows the Popo te altocale and deol data, Under pwyrom niu} -pate_| UnitNo. [Lectureno,] Fy Sculty | Subject Namo Subject Cove A Ute vp pani —Mocation 3 Te Hoo aidjective storie Udyvanie dishinguase blo wmpile eine trum tue sopeuiively: We Soy Yhap sheroge alts calioy 18 SbuFC, ip tk con be made Y unpder bookie hock ay HE pepo Nok ot Whar, proysom the Prgrom dow why id exeuke, Conroualy Asien isdynowics Only while the PU prom Is yumi Main Topics:- e D Mow compiler use tome. Cowbinabion 2for following tuoy Shrew for dynowie ahve aliptalion - ® Shock
m {7% i = partition(m, n);” quicksort(m, i-1); quicksort (iti, n); } } main() { readArray();— al0] = -9999; a[10] = 9999; quicksort (1,9); dy Figure 7.2: Sketch of a quicksort programPoors Date Unit No. [Lecture No, SubJoct Code | Main Topics:- Taaaty = Tame # Adivaliow Rey 3 The protedmre Cally we ond sway aww. Unwell rronazed by wm Hme dat har on adlivertion wecosd (some fine celta ov frome.) 2 On the cnhol djate with the wols q auivaliun fee ak He bottom , ond He tatixe Seyueme 4 odivoHon mands on He Stade comapondirg 0 tht polh in ths auivation be to Ye adivalion oho cnbeol cormally sesi}s Rukwon Value Main Acorns Link [aserd en Bove] mc Stab Hcl date, Heoperonea | Colle Conkeo] Stock: @ach Live achvaHon ASR ne ag fmm ike ‘tratuahons oy txprnsioes in case where tose Heprary * Loco} dato bubrging fo the proudwu who avalon surd INS 1g - A Sore maine about Ht tale y marhine jut bane fue GLb fu fia predurs: Ths } Indus WUE Odden Valux 9 teu LP wu: To whih Hac Cau pigpS oamtaclnae record (see TN _ Temporary values, such as those 2. Local data belonging to the procedure whose a . The actual parameters used by Fig. ¢ Seem Actual parameters Returned values Control link Access link ad machine status Save | Local data ries Tempor: 7.5: A general activation record Figure ing from the evaluation of expres. cannot be held in registers, : sions, in cases where those tempor tivation record this is, _ A saved machine status, with information about the state of the machine just before the call to the procedure. This information typically includes the return address (value of the program counter, to which the called procedure must return) and the contents of registers that were used by the calling procedure and that must be restored when the return occurs. . An “access link” may be needed to locate data needed by the called proce dure but found elsewhere, e.g., in another activation record. Access links are discussed in Section 7.3.5. . A control link, pointing to the activation record of the caller. Space » Space for the return value of the called function, if any. Again, not al ene sediiré: : rab procedures return a value, and if one does, we may prefer to ae that value in-a register for efficiency. : these the calling procedure. Commonly, a whet activation record but rathor in registe!s: m to be values are not placed in the Oo possible, for greater efficic cy. Wwever, we show a spa + offic’ A : iency. However, we sl space© _syntel table Oxgowisahiony > ytnbol_tablt._s.an drnpotont doko Shaidutt tued i conspilen > dyinbol fable ia uA ty let Vt_injrmelioe. Fra $he_ocuwonte ——_iip Vorintd etilies Such a0 objec, cansed_, Vorralble tenn —— ert —n-s4 mabol todble used jor all lvolng —puipast.- _1t is ured_to ste Hae nomeop-oll tliffes_in-o_Sbuctured— joum_of ont plow: al ak ane) ° denliid> ——_—— svi enaorsticolly cone che Sy rba nrme ype bake 2 _akobic int Solory _< Solow Pak, stolic. 2 | type ed 2) Hash table (__Binnay Stands bree | *_|_operationd 2 Onset O_$ imme Or, fa) S Lookup C)# Lnkup ( symbol) 6)Unit No. [Lect pate cture No, =r Faculty Subject Name | Subjon Goue | Wain Toplesi= Unik 05" § code Ophinizotfon Ophimizalion ta a Proysom rnwjrmalion, technique chit tied to ‘Eopove by making Lr comumlbos svwouxrus and ddivoe Wgb Speed Th is the SH phone the wrpller.s and this phase IS Optional « f\ Wd. opHnuzahon Prous yellow the following ulin + GB) te oulpur coda nob, in omy vowy chavye Ha Wow? 4 Hee Popam GJ The optimization sthould invease the sped a tht program ond ig possible he posram cthould domand Leas no: reoowws- [SL opliniation cthodg tut ddloy in oval compiling procs: 9 — Ophinizahion com be divide broadly 4% info two typeo : ® Mausn ‘Indupen dad Sifis @ oplimizodion the compi loc frovapnn PL Wat boi thowh involving omy CPU veyisher, omd absolute Patho Jocotion « fain) tole ( o SHH ew Wde mohon) Donte Cicio) { S 7 ke105 k=105 whue Cid10) L=i+k; icitk; 3 Main Ideas, Questions & Summary: Library / Website Ref.:- —_(2) Hlachin dypenduk # Te 1a dane opto the Vorget eodt hon been, Grated & when phe code 19 Avowafermed acosdirg fo Phe fayer Machine arcu ledure* It Tvolvea ou vqikloe ® moy hore. obselule mem} yun Balhvo thorn yclabive Vy» ® Source g code ptiizations © Compile Hime tvalualow Common lub “¢xpprasion Uiiminalion Dead code tuna Loop ophinizaHove Vouiable prppayahon Cowher [rop jmsbot Foldy Spy popogatiow ® Unrachable wde ¢linunatow C008998onMlZATION OF BASIC BLOCKS opt 533 jmization of Basi 5 optim ic Blocks i als ‘ obtain a substantial improvement j . . et oe riing local optimization within each (ec umting time of code " hin cach ba at how block by itself, More information flows later chapters, Sta rent techniques t ct Foal optimnization, which looks soot! of a program, is covered in | ae subject, with many differ am c among, the rting with Chapter 9 0 consider. ad The DAG Representation of Basic Blocks i it techniques for local optimization begin by i i important ul : n begin by transforming a basic vat qto a DAG (directed acyclic graph). In Secti i sad | ad i i 5 nag as a representation for single expressions. The idea extends naturally inthe collection of expressions that are created x ; within one basic block. We xt a DAG for a basic block as follows: 1, There is a node in the DAG for each of the initial ing tiables appearing in the basic block, OS OF the variables ppearing in Mie baste boc. 1. There is a node N associated with each statement s within the block. The children of N are those nodes corresponding to statements that are the last definitions, prior to s, of the operands used by s. -" > 3 Node NV is labeled by the operator applied at s, and also attached'¥o N is the list of variables for which it is the last definition within the block. 4 Certain nodes are designated output nodes. These are the nodes whose variables are live on exit from the block; that is, their values may be uwed later, in another block of the flow graph. Calculation of these “live ‘Nariables” is a matter for global flow analysis, discussed in Section 9.2.5. The DAG representation of a basic block lets us perforin several code- “Hing transformations on the code represented by the block. 4) We can eliminate local common subempressions, that is, instructions that “mpute a value that has already been computed. 8 We can haa” eliminate dead code, that is, instructions that compute a value f "at is never used. We can reorder statements that do not depend on one another; ier ; 7 value needs to be pr ingt*ting may reduce the time a temporary value a regi 4 register, ‘e s of three-address instruc- ling” @PPly algebraic laws to reorder operands ’ and sometimes thereby simplify the computation.Subexpresgj Dy bad cal Common Pressiong I, andi tected by noticing, as a wl ons can be dete ting node N’ with ie Node ay qubexpres , jg an exist aaa Ne Same ‘is Common jad, wet” ria me operator. f a Computes 4, ig he g adden, and will ace. This technique wag + © San nh, to be es odessa used in it ol oa subexpresee Ona CN {and method of detecting 8 in Seatin a tin he block "6 3.10: ADAG for th Example 8+ acbte pea-d cabte d=a-d in Fig. 8-12. When we construct the node for the thing ay is shown 10 a that the use of b in D+e refers to the node of; we ‘ye e of ae she most recent definition of b. Thy at & TN 0 ny puted at statements one and three. c=bte, labeled —, because confuse the values com bo co Figure 8.12: DAG for basic block in Example 8.10 However, the node corresponding to the fourth statement d= ad has tl operator ~ and the nodes with attached variables a and dg as children. Sine - the operator and the children are the same as those for the node corresponding to statement two, we do not create this node, but add d to the list of definitions for the node labeled —. It might appear that, since there are only three nonleaf nodes in the pace Fig. 8. 4 * “ thee oe in Example 8.10 can be replaced by a block with need to compute th fact, if is not live on exit from the block, then ve® by the node labeled Variable, and can use d to receive the value repres™ ~ in Fig. 8.12. The block then becomes a=bte dza-d c=dte ".u we + poth b and d are li : 535 poy ihe yalue from one co then a fourth stat aun ment must be tC 2 am? ressions that: are guarante for express?” ped to co; fe value is computed. Thus, the DAG a at ; a7 | hod will miss the fact that the vel i" uted by the firsi io" comp! ry t and fourth statements in th le sequence a=bte b=b-d Coa Cbd e=bte sesame, namely bo +c. That is, even though je fist and H yy their sum Sh ee es - +a). *, e, t | +d) ie DAG for this sequence is shown in Fi ie b+e= sietibit any common subexpressions. However, algebrai Ff 13, but does atte DAG, as discussed in Section 8.5.4, may a i a eae applied lence. O (Ye Ge cp. bo co do Figure 8.13: DAG for basic block in Example 8.11 43 Dead Code Elimination Teepe He ieee DAG’s that corresponds to dead-c at no live net We delete from a DAG any root "ove al variables attached. Repeated application nodes from the DAG that correspon ode elimination can be im- : (node with no ancestors) of this transformation Harn. « d to dead code.536 braic Identities Use of Alge 4 The -esent another important class of optin pres apply arithmetic identities, sue 8.5 Algebraic blocks. For ¢ ditatic ic identities re hag xample, we may 0 r+0=0+0=2 rxl=1lXr=2 nate Ct ions from a basic block. iminate computations a bi Pee 7 Ha . a algebraic optimizations includes local reduction in Another class ‘ ator by a cheaper one ag ; Strong, ¢ is, replacing a more expensive operator by a cheape Pas in: that is, re] ° EXPENSIVE CHEAPER x? = Exe 2xa = T+e x/2 = 2£x05 A third class of related optimizations is constant folding. Here We evaluate constant expressions at compile time and replace the constant expressions by their values? Thus the expression 2 * 3.14 would be replaced by 6.28, Many constant expressions arise in practice because of the frequent use of symbolic constants in programs. The DAG-construction process can hel; general algebraic transformations such as co! example, suppose the language reference mai that is, cxy = yx. Before we create a new right child N, we always check whether su because + is commutative, we should then left child N, and right child M. The relational operators suc Ip us apply these and other mote mmutativity and associativity. For nual specifies that * is commutative; node labeled » with left child M and ch a node already exists. However, check for a node having operator «, ch as < and = sometimes generate unexpected t example, the condition > y can also be tested by sqbtracting the arguments and performing a test on the condition code set y the subtraction.? Thus, only one node of the rated eee 2 DAG may need to be genel Associative laws might also be applicable to exp. ‘ommon subexpressi i ose Cc ‘pressions. ®, if the source cod abe lc has the assignments a=bte; es ctdty;’ a=bte tsc+d e=ttp ide this block, we ea aoded outsid » We can change thi jeanne vee Be this sequence to a=bte e=atd ativity and commutativity of +. writer should examine the language reference manual jaqermine what rearrangements of computations ermitted, since ; are permi ‘ines 1 possible overflows or underflows) computer ari permitted, since tthe algebraic identities of mathematics, For ample es eid sates that a compiler may evaluate any mathematically equivalent a sion, provided that the integrity of parentheses is not violated. Thus, “ompiler may evaluate & * y — @*z as x (y — 2), but it may not cralunte iMpre) as (7+8)~¢. A Fortran compiler must therefore keep track of where ress were present in the source language expressions if itis to optimize pens in accordance with the language definition. irs’ © 85.5 Representation of Array References p4sst glance, it might appear that the array-indexing instructions can be ‘rated like any other operator. Consider for instance the sequence of three- aldress statements: x = afi] aljl=y z = afi] Eve think of ai] as an operation involving a and i, similar to a +é, then itmight appear as if the two uses of a[i] were a common subexpression. Tn that case, we might be tempted to “optimize” by replacing the third instruction 2 ali] by the simpler z = x. However, since j could equal 4, the middle “alement may in fact. change the value of ai]; thus, it is not legal to make ths change, The proper way to represent array accesses in a DAG is as follows. ete i J,i ted by creating a sign ex = alil, is represented by ih ohvaler ct and a the initial value of ie with 0 ~ ildren representing perator =[] and two children repres : © array, ag in this as rand the index 4. Variable x becomes a label of this new node. esented by a new node o, j and y. There is that the creation of 2d An aces ae An assignment to an atray, like aj] = ¥> is TePH With operator []= and three children representing % variable labeling this node. What is different 'sBxample 8.13: The DAG for the basie block a(AJ is shown in Fig, 8.14, ‘The node AV for x is ereated first, but when the node Iabeled (1= is created, N ig killed. ‘Thus, when the node for z is created, i, cannot be identified with M, and a new node with the same operands ag and ig must be created instead. QQ: killed =, Ab | de / X he \ LT \ 20 ip Jo Jo Figure 8.14: The DAG for a sequence of array assignments Example 8.14: Sometimes, a node must be killed even though none of its children have an array like ag in Example 8.13 as attached variable. Likewise, a node can kill if it has a descendant that is an array, even though none of its children are array nodes. For instance, consider the three-address code b=12+a x= bli] bij] = y bea atta tenng heres tha, for elcency reasons, b has been defined then b repro Sian a. For example, if the elements of a are four bytes long, aera ‘ents : : fourth element of a. If j and i represent the same value, to have the third J Fepresent the same location. Therefore it is important bird instruction, bE] = y, kill the node with x as its attached variable, However, g i that does ae 7 2 We see in Fig. 8.15, both the killed node and the node °6 the Killing have ag as a grandchild, not as a child. O= DibindeANAM aim eee as -buk. Ap jective —fectang wor Lucey tinspacting the banyth code_is_peephale oplintization 5 -lohidae_ 15 done fy €. a Stiga window q—tmget nabs (colnet peaphele) — aaa al {2 peepho)e by o-— ost ox elec quan I ti 3 . 8 | contain odo pEagmests tn ot one evecisbed i ate (ip tea = =1 yoo Lt i goto Lo 134storie ea = 3 ® eet. g_wnbol optinieatio == $$$ yates r- Aimpleintoumediale _ colt genesis oye tines —— = }_ in _prequnntly proach fimeps-— toast condi ona] —— eee conditional | Sump —o-jreps | pganicsopigiaion nd Rainn in shah —__©_ | Redudion 4 nshupth Anijemalion __©] -Ust_9_Maclsina Tdi mM — DI ngis ie SEL.Code ~ Genes ‘| pa NY ahon Subject Name | Subject Code | Main Topics:- [pate | Unto. [tecture no] Faculty c a 4} t ) ’ Tre fina) Stak Q Compiler mod is corte jinceaton Tt fakes as IPA § Inleourliade sepesaedion oy the aawrce (ort & Produa ene Sulpur &® Quvatuat Jory con by et Papo. the code yenuatton teebrupuna aed tohther cy Mob an oplmuring Phare ocwtud byere Code senecalon Axio ier ae wu Fou om | Ren thd eeu cphivinf—— >] gnexolton Preqron| ciymbo) table +> Follevctne TSSULS TYus I Lods qoruation (1) Tp to tas lode genexation conist 4 the inkermediede ele genceall by jrunk thd, along with the iver GF Sybol fable $e delouuine yum the addresed oO He data denoted by Trlooncdiale God be prrerauted fo The Ud gencxali on frou the provided Bpul doka axe ene pee - Main ideas, Questions & Summary:2) ' i) Teco = Trogsam 6 the oupul” oj The Unde ftnaatoy« He opp May he. obsoluke machine lowg Haye EERE The. Longo may facititale Some machine -pecigi rnsbudions to hdP thy % compiler, genocale IKE code is mee convenient Woy ; Absolute mauwnc a Lowguoge ofp how advertore thok Wis (q. be Place! iy fixed momnaet Rocation, ond con be Domiedianly txceuled ’ ® Relocatable Madune Loraguoye to opi be compite Supexobely + Rdceabable Objeur modules Lom be dunked oy dnade le ® Asumbaly Jonguge Qo o]P tere Moka the cod. enecateon eater + We Con shaale Sypebolic Inohuchonw In genecation — eoele Dw bution &lecHon = The code qunualor takes intounedi okt Reprochtotioly ad inpur & Unvets Cmops) if into Fexyel mackined IWohudion s- One stpreutalon com havemoy wou Cinshudionws ) to Gnvaf irs oUF becomes the yoponaibuuty oy The Welt Flnerater fo thie the appopnale imbuchons vo) sey : {W) Regiskw allocation 9 Onderiva. q wohudiehSABRI > Date _[_UnitNo. | Lecture n lo.| Fac Faculty Subject Name Subject Code | Main Topics: % Bic _Mouks ond _ slow groph 2 Flow graph 3 Banc block 13 seb Q) Shaktrmonte’ Hoa ceboouys se WO AeqUsIN Dre oer Othe ° TK meama that the flow contro] entocs of He beginnig & ub a heaves ak the end voithowk halt All tho. © Bakiment trea in come manos aa’ the qyou- © Ageritom oO duvuving Leadew * Pelowing wde ava Cobled op Ieadex (AJ Puak dhakinest q He colt {8] Texyer Code 4 Phe Wnditivno) Y Unundifoly rrnmeadlialchy oye Pk stake mut. : © ducunine bose’ Hue ee Input — owpur — Mahe @ Teowermotion® J (0 chudune - procwing. Tromyermationa 2} Algerie trommjemation basic blowks [{_ Main Ideas, Questions & Summary: Library / Website Ref.:~
Date] _UnitNo Lecture No, Faculty Subject Name Flow O Th Subject Code Main Topics:~ ° "i doph_ 12 a dtreced Paph 40 the baaic “block « baske block steer 00 Hode « ® There ise direde OPPeaXd 5 Inmet vith flow Irywmation added Hae glove qroph ' J Rye from block br to bletk hs Ip b MHY by by In the Welt pis Main Ideas, Questions & Summary:_} Library / Website Ref.:- oF
You might also like
Theory of Automata and Formal Languages Vip Handwritten Notes by Kulbhushan Pro Unlocked
PDF
No ratings yet
Theory of Automata and Formal Languages Vip Handwritten Notes by Kulbhushan Pro Unlocked
117 pages
COI Notes
PDF
No ratings yet
COI Notes
66 pages
Unit 3 TAFL
PDF
100% (1)
Unit 3 TAFL
75 pages
Mca 1 Sem Problem Solving Using C Kca102 2022
PDF
No ratings yet
Mca 1 Sem Problem Solving Using C Kca102 2022
2 pages
DBMS Handwritten Notes-1
PDF
No ratings yet
DBMS Handwritten Notes-1
204 pages
Daa Notes Complete
PDF
No ratings yet
Daa Notes Complete
203 pages
Coa Unit - 1 Important Questions
PDF
No ratings yet
Coa Unit - 1 Important Questions
10 pages
Theory Automata and Formal Theory Automata and Formal Language Quantum
PDF
No ratings yet
Theory Automata and Formal Theory Automata and Formal Language Quantum
79 pages
Python Programming Quantum
PDF
No ratings yet
Python Programming Quantum
79 pages
ABES Institute of Technology Ghaziabad: Lab Manual
PDF
No ratings yet
ABES Institute of Technology Ghaziabad: Lab Manual
23 pages
4.CPU Scheduling and Algorithm-Notes
PDF
No ratings yet
4.CPU Scheduling and Algorithm-Notes
31 pages
Imp 25 AKTU Ques DBMS
PDF
No ratings yet
Imp 25 AKTU Ques DBMS
4 pages
Operating System Handwritten Notes
PDF
No ratings yet
Operating System Handwritten Notes
44 pages
Web Technology PDF
PDF
100% (1)
Web Technology PDF
359 pages
Mtech 1 Sem Foundation of Computer Science Mtcs 101 2018 19
PDF
100% (1)
Mtech 1 Sem Foundation of Computer Science Mtcs 101 2018 19
1 page
Data Analyst Roadmap by Shakra Shamim
PDF
0% (1)
Data Analyst Roadmap by Shakra Shamim
13 pages
FULL DBMS Notes (All Units)
PDF
100% (1)
FULL DBMS Notes (All Units)
78 pages
Python U 4 One Shot Notes - 5fb3c31c 1918 47a2 Bf55 Feb50cb9a8c9
PDF
No ratings yet
Python U 4 One Shot Notes - 5fb3c31c 1918 47a2 Bf55 Feb50cb9a8c9
32 pages
Database Management System Notes
PDF
No ratings yet
Database Management System Notes
25 pages
WT-web Technology Akash
PDF
No ratings yet
WT-web Technology Akash
54 pages
#Practical 1 - Select and Write Down The Problem Statement For A Real Time System of Relevance
PDF
No ratings yet
#Practical 1 - Select and Write Down The Problem Statement For A Real Time System of Relevance
14 pages
Unit-3 Handwritten Notes Part-2 Tafl
PDF
No ratings yet
Unit-3 Handwritten Notes Part-2 Tafl
26 pages
DE Unit-3 Notes PDF
PDF
No ratings yet
DE Unit-3 Notes PDF
38 pages
Notes For Engineering - Theory of Computation
PDF
No ratings yet
Notes For Engineering - Theory of Computation
25 pages
Operating System Handwritten Notes
PDF
No ratings yet
Operating System Handwritten Notes
68 pages
Recursively Enumerable Languages
PDF
No ratings yet
Recursively Enumerable Languages
8 pages
SEPM Handwritten Notes
PDF
No ratings yet
SEPM Handwritten Notes
14 pages
PPL Unit 5
PDF
No ratings yet
PPL Unit 5
42 pages
Compiler Design Lab Manual
PDF
No ratings yet
Compiler Design Lab Manual
36 pages
Constitution of India Law and Engineering Quantum
PDF
No ratings yet
Constitution of India Law and Engineering Quantum
142 pages
Dbms Practical File
PDF
No ratings yet
Dbms Practical File
22 pages
Compiler Design Programs
PDF
No ratings yet
Compiler Design Programs
59 pages
Theory of Computation - CS3452 - Question Bank and Important 2 Marks Questions with Answer
PDF
No ratings yet
Theory of Computation - CS3452 - Question Bank and Important 2 Marks Questions with Answer
45 pages
Last Minute Revision Notes For C++Programming Exam
PDF
No ratings yet
Last Minute Revision Notes For C++Programming Exam
33 pages
BScCSIT Transaction DBMS
PDF
No ratings yet
BScCSIT Transaction DBMS
30 pages
Automata (Unit - 2)
PDF
No ratings yet
Automata (Unit - 2)
8 pages
NLP Unit 1 Notes
PDF
100% (1)
NLP Unit 1 Notes
19 pages
DBMS - Unit 3 - Notes (Relational Algebra)
PDF
No ratings yet
DBMS - Unit 3 - Notes (Relational Algebra)
45 pages
Unit 2 TOC - CSE - 1595997221
PDF
No ratings yet
Unit 2 TOC - CSE - 1595997221
18 pages
Tafl Unit 1 Notes
PDF
No ratings yet
Tafl Unit 1 Notes
44 pages
Question Bank
PDF
No ratings yet
Question Bank
9 pages
Compiler Design Unit-3 Notes
PDF
No ratings yet
Compiler Design Unit-3 Notes
51 pages
Software Engineering Quantum
PDF
No ratings yet
Software Engineering Quantum
87 pages
TOC-UNIT - 1 (Written Notes)
PDF
No ratings yet
TOC-UNIT - 1 (Written Notes)
29 pages
UNIT-IV-TRANSACTION CONCEPT
PDF
No ratings yet
UNIT-IV-TRANSACTION CONCEPT
50 pages
Data Analytics III I
PDF
No ratings yet
Data Analytics III I
86 pages
NTA-UGC Computer Science & Application Solved Papers
PDF
No ratings yet
NTA-UGC Computer Science & Application Solved Papers
512 pages
Comprehensive FLAT Question Bank
PDF
100% (1)
Comprehensive FLAT Question Bank
13 pages
Python Quetion and Answers
PDF
No ratings yet
Python Quetion and Answers
5 pages
Software Engineering Hand Written Notes
PDF
No ratings yet
Software Engineering Hand Written Notes
47 pages
Course File
PDF
No ratings yet
Course File
6 pages
Ai Lab Manual (Kcs 751a)
PDF
No ratings yet
Ai Lab Manual (Kcs 751a)
45 pages
Structure of DBMS PDF
PDF
50% (4)
Structure of DBMS PDF
2 pages
Web Technologies Aktu Notes by Uvesh
PDF
No ratings yet
Web Technologies Aktu Notes by Uvesh
236 pages
Aktu Notes - Principles of Programming Languages (Rcs503), Question Bank - Uptu Notes
PDF
No ratings yet
Aktu Notes - Principles of Programming Languages (Rcs503), Question Bank - Uptu Notes
117 pages
Exception Handling in C++
PDF
No ratings yet
Exception Handling in C++
29 pages
(Made Easy) Operating System - CSE Gate Handwritten Notes PDF Download PDF
PDF
No ratings yet
(Made Easy) Operating System - CSE Gate Handwritten Notes PDF Download PDF
182 pages
1st unit PPL notes
PDF
No ratings yet
1st unit PPL notes
10 pages
Compiler End Sem
PDF
No ratings yet
Compiler End Sem
8 pages
System Software 1
PDF
No ratings yet
System Software 1
31 pages
CG Notesall2
PDF
No ratings yet
CG Notesall2
46 pages
Jacksparrowresume
PDF
No ratings yet
Jacksparrowresume
2 pages
CG Notes
PDF
No ratings yet
CG Notes
33 pages
3 - Computer Graphics
PDF
No ratings yet
3 - Computer Graphics
59 pages