CD Q-Bank
CD Q-Bank
CD Q-Bank
Unit-II
1 Construct the predictive parser for the following grammar. CO2
S -> (L) | a L ->L,S | S.
(a) Give the classification of parsing techniques and briefly explain each?
Explain Left Recursion and describe the algorithm for eliminating the Left
2 Recursion for the following Grammar CO2
EE+T/T TT*F/F F(E)/id
(b) Show that the grammar S -> 0S1| SS |€ is ambiguous.
What are the limitations of recursive descent parser? What is Left Factoring?
3 Write an algorithm for left factoring a grammar do left factorization for the CO2
following grammar
S iEtS | iEtSeS | a Eb
4 Verify whether the following grammar is LL(1) or not? CO2
E®E+T|T T ® T* F / F F ® (F) |a|b.
5 Design a non-recursive predictive parser for the following grammar. CO2
S -> AaAb | BbBb A -> e B -> e
Unit-III
Consider the following grammar SAS| b ASA|a Construct SLR parsing
1 table for the given grammar and show the actions for the parser for the input CO3
string “abab”.
2 Construct LALR parser for SAA AaA/b and parse the input “aabb” CO3
3 Write the steps for the construction of CLR parsing table. Construct CLR CO3
parser for the following grammar
SL=R | R L*R | id RL
4 Define Type Checker. Write down the specification of a simple Type Checker CO3
5 Write the quadruple, triple, indirect triple for the expression. CO3
-(a*b)+(c+d)-(a+b+c+d)
Give the syntax directed definition for a desk-calculator.
6 Explain in detail how an L-attributed grammar can be converted into a CO3
translation scheme.
7. Explain about Three-address code generation with its implementation. CO3
Unit-IV
1 How symbol table can be managed? Explain CO4
Construct basic blocks, data flow graph and identify loop invariant
statements for the following.
for (i=1 to n)
3 { j=1; CO4
while (j<=n)
{ A=B*C/D;j=j+1;
}}
4 What is Peephole optimization? Explain its characteristics. CO4
Unit-V
1 Explain in detail about inter procedural optimization with an example. CO5
3 What are the principle sources of optimization? Give the classification CO5
of code Optimization.
4 Explain the role of semantic preserving transformations and CO5
dominators in code optimization.
5 Explain with suitable example various sources of loop optimization CO5
and dominators in code Optimization.
Faculty HOD