CD
CD
CD
EW
.C
O
O
R
LD
JN
TU
3. a) Obtain the stack implementation of shift reduce parser for the input string id1+ id2* id3
for the following grammar
E E+E
EE*E
E(E)
E id
b) Discuss about shift reduce parsing conflicts that arise during parsing.
[8+8]
4. a) Write a translation scheme to generate three address code for assignment sentences
with array and pointer references.
b) Consider the following declarations
type link = cell;
var next : link;
last : link;
p : cell;
q,r : cell;
1 of 2
Set No: 1
[8+8]
[8+8]
[8+8]
.C
O
5. a) Describe in detail about storage allocation for arrays, strings and records.
b) Discuss about implementation of simple stack allocation scheme.
EW
7. a) Determine the pre-dominant block of block B2 in the program flow graph from the
following code
../* Block B0*/
o to 100 /* Block B1*/
100 go to 10 /* Block B2*/
b) Describe in detail about next use information about names in basic blocks.
[8+8]
O
R
LD
JN
TU
*****
2 of 2
[8+8]
Set No: 2
.C
O
O
R
LD
EW
JN
TU
4. a) Give a syntax directed definition to translate infix expression into infix expression
without redundant parentheses for e.g. since + and * associate to the left ((a*(b+c))*(d))
can be rewritten as a* (b+c) *d
b) Translate executable sentences of the following C program.
main()
{
int i = 1;
int a[10];
while (i <= 10)
{
a[i] = 0;
i = i + 1;
}
}
into
1 of 2
Set No: 2
i) Syntax tree
ii) Postfix notation
iii) Three-address code.
[8+8]
.C
O
5. a) Describe in detail about symbol table format and organization for block structure
languages.
b) Discuss in detail about the issues of source language in run time environment.
[8+8]
6. a) What is a basic block? Write an algorithm for partitioning a sequence of three address
statements into basic blocks.
b) Explain about local optimization in detail.
[8+8]
EW
[8+8]
O
R
LD
JN
TU
*****
2 of 2
Set No: 3
EW
.C
O
O
R
LD
JN
TU
4. a) For the input expression (4*7+1)*2 construct an annotated parse tree according to
syntax directed definition of desk calculator.
b) What are L-attributed grammars? Explain the steps involved in converting an Lattributed grammar into translator scheme.
[8+8]
5. a) Define symbol table? Explain the need for symbol table organization and the data
structures used for implementing a symbol table.
b) Explain about the block structures and non block structure storage allocation in
detail.
[8+8]
1 of 2
[8+8]
Set No: 3
JN
TU
O
R
LD
EW
.C
O
2 of 2
[8+8]
Set No: 4
.C
O
O
R
LD
EW
E E+T|T
T T*F|F
F (E)| id
Trace the grammar by Brute force method for each of the following strings
i) a+a
ii) a+a*a
iii) (a+a)
b) Check whether the following grammar is a LL(1) grammar
S->iEtS|iEtSeS|a
E->b
3. a) Construct the LALR parsing table for the following grammar
EE+T|T
TTF|F
FF*|a|b
b) Construct SLR parsing table for
S abS|AAab|b
AbaAb|b
[8+8]
[8+8]
JN
TU
4. a) Give the translate scheme to convert an expression grammar into three address
code.
b) Generate intermediate code generation for the following code along with the
required translation scheme
int a,b;
float c;
a=10;
switch(a)
{ case 10:c=1;
case 20:c=2;
}
[8+8]
1 of 2
[8+8]
Set No: 4
6. a) What are the applications of DAG. Explain how the following expression can be
converted in a DAG for a+b*(a+b)+c+d
b) Describe in detail about considerations for optimization.
[8+8]
.C
O
JN
TU
O
R
LD
EW
*****
2 of 2
[8+8]