You are on page 1of 2

KCG College of Technology,Chennai -97 Computer Science and Engineering CS1352 Principles of compiler Design Assignment -2

1) Eliminate left recursion from grammar E -> E + T | T T -> T * F | F F -> ( E ) | id 2) Eliminate ambiguity from the grammar E -> E + E | E * E | ( E ) | id 3) 4) 5) 6) What is left factoring? Give an example. What is Recursive descent parser? What is FIRST and FOLLOW of grammar sysmbol? Define the term i)LL(1) grammar ii)Handle ,(iii) handle pruning,iv) Viable prefix 7) Define operator grammar 8) Define LR Parser. What are its advantages? 9) What is a shift reduce parser? Explain the conflicts that can arise in the shift reduce parsing. 10) Define the terms i) closure ii) goto iii) LR(0) items 11) What are the parts of YACC? 12) What are the advantahe of context free grammars? 13) Explain the configuration of i) LR parsers ii) Predictive parsers 14) Explain in detail the table driven predictive parser with an example. 15) Tabulate the moves made by a predictive parser for input string id + id * id 16) Explain in detail the stack implementation of shift reduce parser. 17) Define Context Free Grammar. 18) What is an ambiguous grammar? Give an example. 19) What are the problems with top down parsing? 20) What are kernel and non-kernel items? 21) Explain in detail the working of an LR parser with a diagram. Write the LR parsing program steps. 22) Explain with a table the moves of an LR parser for the input id +id * id for the grammar (1) E -> E + T (2) E -> T

(3) T -> T * F (4) T -> F (5) F -> ( E ) (6) F -> id 23) How an SLR parsing table is constructed? Explain with an example. 24) What are the benefits of intermediate code generation? 25) What are the various types of intermediate representation?

You might also like