INTERNAL QUESTIONS FOR COMPILER DESIGN

Monday, March 1, 2010
1) a) Explain the different phases of a compiler ?
showing the output of each phase using the example of following statement
position:=initial+rate*60
b) compare the compiler and interpreter with suitable diagrams?
2)a) consider the grammar given below
E->E+E/E-E/E*E/E by E/A/B obtain leftmost and rightmost derivations for the string a+b*a-b
b) explain backtracking with example?
3)a) what is recursive descent parser? construct recursive parsing for the following grammar
E->E+T/T
T->TF/F
F->F*/A/B
b) what is an ambiguous grammar? eliminate ambiguities for the grammar
E->E+E/E*E/(E)/id
4)a) construct LA,LR parsing table for the given grammar
S->cC
C->cC/d
5)a) construct a predictive parse table for the given grammar
E->E+T/T
T->T*F/F
F->F*A/B
b) what are the limitations of Recursive Descent parser ?
6)a) what is LEX?
Explain in detail different sections of LEX program ?
b) write regular expression for the following pattern using auxiliary definitions wherever convenient
1)the set of words having A,E,I,O,U appearing in that order although not necessary consecutive
2)comments in "c"
7)a) explain various forms of three address code?
b) what is an operator grammar give example?
write an operator precedence parsing algorithm?
8) write s-attributed definitions and L-attributed definitions ?

0 comments:

Post a Comment