0% found this document useful (0 votes)
94 views34 pages

CD Notes

Uploaded by

srinujodu1431
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
0% found this document useful (0 votes)
94 views34 pages

CD Notes

Uploaded by

srinujodu1431
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
You are on page 1/ 34
oar gfcompiler is a taavitlatoy voli converts cow AAS SON under santa ole language - Ce Ot. ighy waclane [pox will —9 [computer > Assert Ward Songusgee “eye Sonace ode — >[ compiler a > machine undiastandalds. Jamquoge (saa get cost) (uueqa level dewxguege) attespacter Rakes LL reads Vine by Line ound Convent Ins wmachine code and exccitles immediatly» Assembler taes assembly level Language ard convert ite wncline, code . Triesprein4 language Jowsuoges which vises Compilers “ram = ~phe . ot ; — Raley #lAocoludte_Code ~ WE nerd to toad Code (vile adeioress Lexical Awaliyes (piste ~ Synalar Avaliytis / Analisis plane Passe fre Symbol -}— Semantic Aialyns me dee IN. Tmmediate Code Gewese ion Jp syrtee pve “Code option” sable Manager Lexical + Lexical avalyzer does lexical analysts “5 . + du his pias tae fexical avalos mreads “the character cw the Source pam and qn them who a sheam of -+okeus. Tbkos ase Seqpomee of Chimractas lowing couective meaning The Character Sequence fowws ing rekon is called lexemne. 4S) blank paces wilt, Ge elimindled. +Tn lexical analy: Syatax Avals Avalysic! [Seam of -tokens] — Syrttax: eae 5 —f Parse Tree] ge Pee fs qe ps the tokene of Cource m into te we “ axe used by the compiles -to qonesoce ae a « This_is represevted by @ Se hee, also ties “3 un as Syntax tee._| ids tht the td id id — > th povicled tokens and yietd af patce sree ate garne then Soprctr Ce voon'+ pease d exrcis Semantic, gis “looks fa si aS b veaiges 1E Pase + Seynaystic Analyt. Ene ee -Undeclaxed vacinbles ~ Misuse vf whesied voords = Multiple declasation of youinble of & single Stope ~Aecessing § out of Stope vasinble. — Mismmoxch loa asomwlecs etc. *Semausic Aralysic performs type checking twat Us, it crecks etch Se has operands “that ase pesmited by sore, larg.. seein fat a [is] > Gow ieee E secehile pl brleges, ‘as size zh 2 atnay ~ asec on ee genera (ton Seteymrediate Cole Semantically Outoumrodialt Asif ted ce pee (ode Oulermediate ; Cocke ~ Generale? Pr ids idtide id or ve (bec resevtlatiovd of Coyato. Code should lee casyt, to Yrarstate TL0 the “Lacget preyam. fast | level — Twter mediate Fen Produce and ease r “Always starts pom “(he ho toc be CS Reodpe att 5 Bo eels Code Optimizer | “CO is an optioval . phase “at op tinizes the iwhleemaciale tocle [eee |— Code. Optimization — Optimize Code aye bre; ___+ opted v a a 4, (0-4) 0,2,4 —> Lexemes a Shot a lexeme ~ Lexical a aw is irnpurnea by DFA ~ Phaser © tmpbmented by Ppa = Lexical analysis pra neu exCommet tines oud while SPaces 7 pearl eh] ven pesslelt ta" fra 0) 4) Uf S toleent Wy ches an enby sy DT Ht reads any tdinrigions then Ore able and Stes info aloout it upto that r tO), Siva] Name] type| oat int ss => 202504 0? = of anything tat doesn'é woctch with species mules /patteans, od 2 ) k owt Carvesporcing enty is raised tn LA prox tex [eLex (fastest vession of LEX) > Softuinnes “x. Q—eatension Leete name TA lex program is cepasdiled Unto a sections by 1 t delimiters ‘The format ° lex Sure is : Ue Subrutines / Auxili cei urchicle declarations Of com stant, Vasiobl dr, A requsos. dedinitio efit the Stat a . define Bre Steigraen Bf form P faction 14 PAaction sy techs 5 sunentins ae alee praens Matas by “the actions cuinmantine can be loaded “wilt the Lixicat analiper asd ; compiled stprsately « 2 De vot use Comment Lines tn rules section, peal heat Can berwsed in DS & Uss ner, we need +o explicitly -Tn Guinot invoke LA pre mainc) 4 yylex O05 Jivwking LO plat a yy vovep| uy coe on mes Ue coved as, Shings in gyre “By Defautt, xe LA Findude Ly Lt fo-J A get (WES 1S - Pease tmoind? aA. digit th yy ext) 3 ‘ yylexQ* 4 ash an [ten] see y* UP ofp cm bapey ~these 16 any Up in. buties ov fin den we can use f, ay on) “LA please alwoarys reads ip a * YrjevoapC ) — indicates whrellaer +T rye don't want to Use yyurae © at he wp 4 she Up SD wn king wilh multiple Pe — Hierarchy is impostaut tar Lf. {o-4) 4 pont (as, te aiget " yigtest)) } (0-4) +4 pe (Mhs i rumnber"s yy extyiy At omotv digit to — to is number Lh (o-aJ+ A pratt hs is a number", yytert)i J (0-4) A pratt (wigs Is a digit" yytext) i ys ht 070 number //wron AW So, {o -4| shoud be wiilbn fost & -+yen (o-4)+ “ie (a-2 A-2) (0 fA-2 o- J # {pr Ciaantigen); 4 ant” | “float A prt ("keyword"); Lh pith Crepoott)s int 3 tdontirfier Aru jain we Ove as i : r qi aes ee gel identifies as olp (owen if it ic Eeapo ve "wt" ["-fCoe " firct [a BA-7] (a-3A- 20. AJ r neve “yyen © ~ etUENS length Of, Lxemne f yyen — entoe file as Up gyin -fapen (hare 4a"), 7 Pangea to Count wo, Y Words tA tut we <0; “4 bl. (a-zA-2]* Awerty § “\o" A print (hd we)34 ro ; yylex CD poy tb count wo. of Lichegers avd real numbers & pretty count int C0,7205 To Read me Character, tf Ly Wwe write It divectty Hen a it eats tt as meta [e “at Ait \ Character, (0-4) * Sopwe [o-a] + \+ fod Aret’s vited ty use "Yn" A prints (eld td L.0)7Y Wh mainc) iM quven txt : a etal Assi Uiquovs o7 vot > 5 clot am vy : Given cre for RC OM, MN? ) so Ale pie n 200 |F Si O51 [£ > vole 6 S 1 S2]£ canton Yaie cre for RE Qe)? . { SS So i 5, 00S, }é KR 3 : o S$, 18, |£ ny FJ Equak vio. of a's & b's, qolindanme i S—a5b | Sa |gsl_ |s-sasalosblale A ; I 4) Derive o0001t by using ! following Cra / Not / ambiquotes 0 oe Ay b) ssosilss] é A 2008 |e fy ie aa A\ ot s $ pores mye ZL\ /\ S$ ep EP. JAB & es } A : ALB 4 a ALIB ! — 00hité nian, — 0oocoR ll — 0000EI >) 5-9 Sb5|a — = covet! 5 7 LOD: soap AN AN — ov Ab Av a iN — 0000AB Sos a is J} nga Av | — D000EB LA nt —7 000018 ia 5 og rag. Heals There exists a passing algo “to che ck Whether liters an ¢ . Uhous ass i comect @ not = _ lelafbI--) a Es Agi — ep Stack Fife Technique [Passing tab) Passing Techniques , Dnivesal ses — Con parce am 146% of Gaarnines — Dve to Daahiclency wot being wed “Fp Down poses — as Limp ‘ -|Brttom ery —— RIMD im vowerse over 0 Ope TE ae J [ip pon tas) «= ee" GE) Cu) | predictive pass 4 ears Non-recusgive. top-down 2 fw Uses i y yecurtive calls. poang oi LUCE) [Predictive passers *FinstC) & follows) baa “used tn Conscbuction of passing Fechnigues. "Rules fox first CO ) BH Aa ben “fast (A) = jay ) Ne tne fire (ne 165. 2) 24 AaYMe, first (a) © FistQn) -if Ye Hen first (Ye) Lid disst(a) = Fist Cv) U eivst (2): —— #4 te i should not be ; mea apply dag passting -Jechiniqu« grams Ou in he {1 Recu gion. * Sana A sb|vCe [Daa C Sabb|d Dada SD is welets.as D vot deniving Heaminaly Airectty [iwelivecat, No null productions > No onit, productions [Nt NI] 7 l MO? = Rett Recuasion + heft ae «lp: AA “lp . A A “ete voy IN Al _»s Ale Ay a Nee “al PB oF /\ p yYfCr erat i a To T¥eFle F id Je p PEAT DLR. . - feb) Kigud_ Recursion €'— +Te'|e Aa alps A E T>T¥ele 4 A aoa voN LN T> FF! (Fr) p< A A Tren |e ! Ls Wen CFG, €—>Te! re p 1 >Fr i “= +Te'/e Toe [es Fo idis ; eoTe pi +e lé tort! qo set le —_ id (Ce) cont (6) < Fnst U) Fostl)= (LG cast (e)= Ate) gost(t')= 4085. js aaAld po cdlef fast (5) = haya fiost (A)= heed §) sa nce|Cbb| Ga A= da| 8c 6 79/€ co hile Fists) first (A) vost V firse(8) : = {gyAvesnyu Aheel viaead = hayb,argshty Fost(a) = 4.4.4, net Fist(py 2 4q,€4 Fist (c) 2 Ah é4 h) Sane, A cle Bdle Fist(s) = hal Fist (A)< fo £4 Fisst (8) ae} 5) S> Aabh| Boea ATE Boe Fist (= sarevieod 2 fonb,e4 FOE “First tn) = 484 Fist (B= AE4 Riles for_fo \low for stacting symtoel a) A> KBB Follow (B) = Jost(p) JAS«B 1 POF fq « Saald Ascdles Follow (s) = Ag Follow (A) = 4 fi 2) S7AABb Ax Cc\e Bodle ale) = 44 lA) = fost) = {4b4 fle = Ao} follow (8) « -fotte (8) jaad f 3) snce|c b6|84 A—da|BC Be Cone Follow (5) < h $4 Follow(n)= Fist (B) = 4h, aft Follow (8) = fash qd 44 Felon) = fa,g, bh, a Y Fost(n= 44, 9, 68 First (8) = bqve4 Fost (ed: huey i {hits qsa, ody pote i HOO Fics FILA) goat lé / AC idl qt Ft Ficer)= Aayey “ Tere | OV Greed pce) fid cota ale) = 44, v4 plt)= fice = A495 a(t)= {44 yi fo(F)= Fi (1): 4m, +, $, yy LAW | Predictive | action stack ce ete’ fk id sia Kid q . eT pid + 7 # wa vewiched, ple els+Te metehe st r— eT Froid tA matched. lore’ maiche oid TA matclr< 4 Yi se eles MACE, Success pel GO ACB|C be | Ba “joke A dal oc f (d+ A byt 4 * follews , “r(eys AQF oh ql PO fdig by 8 FAB cobs Weeds fag b £ay FA) hoa Fh | a bole | do} ree 4gab9) - SoBa\ SeChB |S be 6 | SOA a ph | SO ba . ‘F(0: 49, 4,64, + A | ada [ABC ABC . : 7 Boe : AT lex progam to find re, of Vowels and consonavdds ju the Gren Shing Cee peer Ae fing nv. of vines, pores ard chosactes inte inpet. cd Ftp aunt ne- of integnss , fie ating pont nos from eo inpek. ; o- 4+ \: : tr (sf out of atl word 1 Cungth Wee stoeting wt a. yylen x #10 pogo +o “find firt & follow 3 fla GF Grammer: — x] SOA SoA: j-abad A ~anfad (Le) Az in tt Bobet Aaa 5 abhl i { A + AD! 4 E oa aloartle Fis pf: Colles F(s)= 4a} e() A$ E(a) = fa} (A= APY F(A’) > £484 ecat) = Af e(8) = 46/4} | Ce) = Five (al) v Font (OD roe Ada F(c) = jdt 9} —_ Foxséng Talele i jo ie iy fF Tp s | saa A | Avaea' A) 4 -dal Alssé % B>bBe Bof C Action SA A ata) a matte S b> bBC bp natehod . BOF 4 modeled, cy ¢ / S> AnAb | 66B4 EV est T ; AE ee | + 4 Boe T7374 ii Re cur stor | No left Recursion cett : : % \ First Follows, elo + TE le. €7Te P(s)= ha, of pis)= Ad Pests Flas heh — FLD = 4070) Toe F(e)= heh. Fle) = Lb) ginets Follows eT eceee= kar FCO =H} F(e)eAn2y FE oAfh PO 434 e(r)= {4 fi a b S |5-Aonb] s7ePbs stake fs abt Sanaa fora bf AE £bA q Beh a matthed Sek ; $b a __¥f fe f f | ; ceed ge me TT py AR sain ego 4 f succesegul \ a ae fete fof 1? tee ge a 4 Su cost e with i Mode we ep ‘Ke coves — top yf a CA cearvert ase sapeet Set ea respective 7s ond CY cash Ay fe 4idf omamwate he 4 casen! fe 4 +idg Recovery Technique Panic Mode Steers watt ear nals sacle up fe fide vid ger Arr iad Lee ida idd fen triad Ss arbc[ar athlon 2h qe Fid tA irked Bott Up Passén uses RMD in severse onlet S—aabe A >Abc]b Boa =. abbcde A Ge Ss Sa ahbe /\ S safieede An Fi $7 ahpede { | S abbede- abbede =) Bettom Up Possess are alto Kuawn a Shift Reduce passers (2) poses: — a fous aLtions- Slift, Reduce, Acttpe, Reject + Binur bide pest (hardle Ss yeploced oy left side. eo) rR — lon be applied wen on Rew ve rrammagg. ARIs) items Aa NZ A? XYZ A2Xwee A OXYZ- (Complete [ina seduced jte9 — indicates row fat vere Seow + =. i , 2. RWS AS Clasise a Me i A7 G-Bb B33 item if 6B precech by non~ Tera) als Set vf Lies 7] — seymbel (any er bets J. ava. bb gots [2,8] : v Adfune- (A248 b) => A> aBb slack pudy aumbes, ade eect add 1 a ae nie ref d oS Peete ‘yl ~ s “Anguenc wt ye? La? * ae [sta] — stout lp ) e JL gos (a) g Sa joe 9 Lfoceag 96 HS 2 2| 2 x, : poc sf 2,L25 ; To] focety 7f se sfeafess|s[z5] 1) powsenn fer “(mia Figae _ . lelel tre) PS accept = ws 3 UY) we [TY | a’ Overtome S-R eonglitt, woe altace SLRC!) , $eraf eet Algatithen, fas » Eottaa (1) e hott . |_-__—- Reduce - Reduce Conf lick + i¢ aus oat ap $3 fons taf 2,0 foto._+a¢ Su $3 Ariat ged ee fore wite £ re" forrener £ ue sot f AE Osa Aanb (been Ee Az GAre (Pe $,Bbba- Az one u hans a 5 cr k ane (po €(a): fa64 F(8): 4b, a4 a5) = 4g4 “Reduce Reduce Conflict” Not SLR Grammar CLR ~ Gannonical CR lassen Le) or arti) YL CRO) 4 book ahend cles ysAAa AAA As VA fe gonzaui he “donaannh vg fos __f accept a gone n SLR Vsnn- Daan JAIL CLR contacns move space thar ia SUR» LAL: Adentity URI) Hom fires le Heme ane samme bat lootatod Symbols axe differnt » Mezge such states - The main qt ic to Wduce the tthe size “of. CLR. fal Dag) omy eae Se ON menged, - CLR + mange Gtates = LALR - No Specigic DFA -@o use aR’ » CLR i most t wh echuique but ane cto its inepprcrer] we 9° weth LALR. wee LALR ' Perea grams is CER but nel Vice ‘ versa Recursive decent coves eTop down pacser + GreeUmMan fliula be free fom lof (ae cur, itn for EVEN Wlon- Letninal , cle fine pec dures. 1k t SAA gobne a 3) 52 BFE “D4 ciune one conppiets, MMe CLE elie can mse LA LR (aptimiael versie of tae)

You might also like