You are on page 1of 4
1. Consider the following grammar and try to find out Operator Precedence and Associativity. Isthe grammar Ambiguous? If so, find a string for which it is ambiguous and finally, convert to Unambiguous grammar without changing the original Language. (4 marks) SS%A/JA A>BtAB BOBE&CIC C>S/id ide & > * D> % > beff 200g C 4D righ! ass0~eve ES fefh su ocrhve consiberg dt *it hid Cp fis LO eM, Bis anb/o70u8. 2. Consider the following grammar, and try to parse the string ))))))) using all the conversion and steps in LL(1) parsing. (8 marks) $—8))/)) where variable = { S } and terminal = { ) } Ifparsing is not possible, point out why it is not possible. The gramme ?s 2 CRO, for. we heave to convert rt 40 KK Or s> a FLRG a Mee peta Ping Fetlaw S>y sé 4 yy igs 8 yy SYE Ce <> LU) groing table: ? S 5S) 87 Ss” Sia pS SPE song [tx] a7 ALT [S| PRR PRD a7 ole boblshta ls be Remand foe As, There js ith varizbles & fer nghs Aerratning wo fhe stack, thes qrermnaz js pet — pr” xxble, thls BnT Or wecegh even 0-07. Chasing ne 3. Is Recursive Descent Parser (RDP) more powerful than LL(1) parser (or LL(I) is a subset of RDP)? If you think so, justify your answer with explanation. (3 marks) LLL) ps 2 subset of RM. This /3 becewse, ROP cw fPoue oy of LL(h). Are, LID can Onl, parse ene trom tt ROP can ots9 Provide memory zaton technrgue ehWch (é() docs rar prrev/he. Thus, bo yg option RPP is mare powertell than dUS & Ll) s @ Sabsehofé LYS 4. Point out TRUE/ FALSE of the following statements: (5 marks) (a) Left Recursive Grammar can not be used in LL(1). “73rer @ (b) Recursive Descent Parser can not use Left Recursive Grammar, Tew (©) All unambiguous grammar are LL(1) parseable. Foe5@ (4) 3 address code is generated in Intermediate Code Generation phase of language translation. “T2e¢(2 (©) LLC) isthe most power parser. Finds @

You might also like