Docsity

Lalr parser notes by prince Gupta, Lecture notes of Compiler Design

Partial preview of the text

Download Lalr parser notes by prince Gupta and more Lecture notes Compiler Design in PDF only on Docsity!

490 Comprehensive Compiler Design The productions for the grammar are numbered as shown below; S— aSbS () 5S .bSaS SOE EXAMPLE 5.6: Construct an LALR(1) parsing table for the following grammar: S— Aa | bAc | de | bda Avd The augmented grammar is: s|jo Ss S— Aa S— bAc S— de S— bda Anvd The canonical collection of sets of LR(1) items is: I= {S| > .S,$ S—> Aa, $ S— .bAc, $ S > .de,$ S— .bda, $ A> d,a yo , BIO S)= {S] > 5.,$} = Boto(Ty, A) = {$ tes) =} goto(I,, b) = {So b.Ac, $ - S b.da, $ Axr.dec aL D= (S++ de§ cae =I] ¢ goto], a) = {5 ee ; goto(l, A) = t5_, 0 9) = 4s Ss bac$)=7, goto({,, Scanned by CamScanner