Professional Documents
Culture Documents
UNIT-I
1. What is compiler? Explain the various phases of compiler with neat sketch?
2. a) Explain the functions of the Lexical Analyzer with its implementation?
[15 M]
[7M +8M]
[7M + 8M]
[7M + 8M]
[7M + 8M]
[7M + 8M]
UNIT-II
1. a) Define a context free grammar?explain with example.
b) Consider the grammar
S->(L)| a
L->L,S|S
[7M + 8M]
[10M + 5M]
[7M +
8M]
b) Explain about the backtracking?
5. a) Define ambiguous grammar. Elobarate with suitable example.
8M]
[7M +
E->TE
E->+TE|
T->FT
T->*FT|
F->(E)|id
6 .a) Check whether the following grammar is LL(1) or not?
S-> Aa|bAc|Bc|bBa
A->d
B->d
b) Explain about left factoring and left recursion with example?
7. a) Check whether the following grammar is a LL(1) grammar or not?
S->iEtS|iEtSeS|a
E->b
b) Explain about recursive descent parser?
[9M + 6M]
[8M + 7M]
8 . a) Find the predictive parser for the given grammar and parse the sentence (id+id)*id.
E->E+E | E*E | (E) | id.
[9M + 6M]
[9M + 6M]
[7M + 8M]
UNIT-III
1. a) Define bottom up parsing technique? Write the differences between Top-Down
[5M + 10M]
7 .a) Construct SLR parsing table for the grammar and parse the string: ( )( )$
[10M + 5M]
SS(S)
S
b) Explain about the actions of the LR parser?
8. a) Describe briefly about YACC parser generator.
[8M + 7M]
[9M + 6M]
S->CC
C->aC|d
b) Write short notes on Shift Reduce Parser?
10 a) Build the SLR(1) parsing table for the following grammar:
E->E+T|T
T->T*F|F
F->F*|a|b
b) Distinguish between the CLR and LALR parsing?
[10M + 5M]
UNIT-IV
1 .a) For the following given grammar construct the Syntax directed definition and generate
[7M + 8M]
3 a) What are the various methods of implementing three address statements? [7M + 8M]
[7M + 8M]
b) What is a three address code? List the common three address instruction forms.
5 a) To construct the 3- address code for the following expression.
x=-a*b+-a*b
[7M + 8M]
[7M + 8M]
[15M]
8 a) Draw the syntax tree and DAG for the expression (a*b)+(c-d)*(a*b)+b [7M + 8M]
b) Give the translation scheme that converts infix to postfix form for the following
grammar. Also generate the annotated parse tree for input string 2+6+1
E-> E+T
E->T
T->0|1|2|3|4|5|6|7|8|9
9 . Write short notes on the following
[4M + 4M + 3M + 4M]
a) Activation Record
b) Dynamic scope
c) Call by reference
d) Access links
10. a) How would you generate intermediate code for the flow of control statements?
[8M + 7M]
b) Explain about the S- attributed grammar?
UNIT V
1. a) Explain the design issues of a code generator.
[8M + 7M]
[8M + 7M]
[7M + 8M]
[9M + 6M]
5 a) Write shortly about DAG (Directed Acyclic Graph) representation.Draw the DAG for
the expression a: = b *-c + b*-c.
[7M + 8M]
for
a + a * (b c) + (b c) * d
[7M + 8M]
a) What are the object code forms ? explain the issues in code generation?
[8M + 7M]
d:=b*c
e : = a +b
b:=b*c
a:= e- d
9
[8M + 7M]
[7M + 8M]