Assignment-3: - B. H. Gardi College of Engineering & Technology
Assignment-3: - B. H. Gardi College of Engineering & Technology
Assignment-3
1) (i) Consider the grammar S -> SS+ | SS* | a Show that the string aa+a* can be generated by the grammar. Construct the parse tree for it. Is the grammar ambiguous? Justify. (ii) Write production rules for producing following language. 2) Eliminate left recursion from the following grammar and rewrite the Grammar. S -> Aa | b A -> Ac | Sd | ^ 3) (i)Perform the Left factoring of following Grammar A ad | a | ab | abc | b (ii) Find out FIRST & FOLLOW set for all the Nonterminals S AcB | cbB | Ba A da | BC B g | ^ C h | ^ 4) Is the following grammar suitable for LL(1) parsing? If not make it suitable for LL(1) parsing. Compute FIRST and FOLLOW sets. Generate the parsing table. SAB ACa | BBaAC | c Cb |