RTU Previous Question Papers B-Tech CSE 7th Sem Compiler Construction Dec 2011

RTU Previous Question Papers B-Tech CSE 7th Sem

Compiler Construction Dec 2011

Paper Code: 7E4091

Unit-I
a) Explain all the phases of compiler with the help of suitable example.

b) What is the basic task of scanning? What are the difficulties found in delimiter oriented scanning? How can this be removed?
OR
a) Explain the concept of input buffering in details.

b) What is the LEX? Explain.

Unit-II
a) Consider the following LL(1) grammar describing a certain sort of rested lists:
S->T S|E
T->U.T |U
U->x|y|[S]
i) Left factor this grammar.

ii) Give the First and FOLLOW sets for each non terminal in the grammar obtain in part (i).

iii) Using this information construct an LL parsing table for the grammar obtained in part (i).
OR
a) Explain various error recovery strategies in TOP DOWN parsing.
b) Show that following grammar:
S->Ac|bAc|Bc|bBa
A->d. B->d
(S,A,B are nonterminal. a, b,c,d are terminal) is LR(1) but not LALR(1).
OR

c) Frame the transition table and Action/ Go to table for the grammar E->E+E|E*E|(E)|id.

Unit-III
a) Explain L attributed definition.
b) Give the syntax directed definition below with the synthesized attribute val, draw the annotated parse tree for the expression (3+4)*(5+6):
L->E L.val=E.val
E->T E.val=T.val
E->E1+T E.val=E1.val+T.val
T->F T.val=F.val
T->T1*F T.val=T1.val*F.val
F->(E) F.val=E.val
F->digit F.val=digit. Lean val.
OR
Generate the three address code for the following c program:
Main()
{
Int i=1
Int a[10]
While(i<=10)
A[i]=
} [Marks 16]

Unit-IV
a) Explain procedure call with an example.
b) Explain various approaches to symbol table organization.
OR
a) Explain format of an activation record.
b) If we want to support local arrays of variable size. Then suggest the storage allocation that is suitable to meet the requirement.

Unit-V
a) Construct the DAG for the following basic block:
D:=B*C
E:=A+B
B:=B*C
A:=E-D
b) Discuss various popular code improvement technique.
OR
a) Explain basic block and control flow graph.
b) What is loop in variant computation? Give an example?

Leave a Comment