cse-7-sem-language-processor-winter-2016
cse-7-sem-language-processor-winter-2016
com
om
11. Use of non programmable calculator is permitted.
e.c
1. a) Explain different phases of compiler. 9
lin
b) What is boot strapping complier and cross compiler. 4
on
nu
OR
m
.rt
2. a) Write a LEX program that recognizes :- w 9
i) Keyword if, while, for
w
w
ii) Identifier
iii) Operator | | | 1 .
b) Why lexical analyzer reads few characters beyond the token in advance before declaring 4
validity of token. Explain with example.
3. a) Generate CLR table for following grammar. State whether grammar is CLR or not. 10
B bDAe
om
e.c
D Dd; | E
lin
A A; E | E
on
E B|a
nu
m
OR
w
w
4. a) Construct LL (1) parser for following grammar. Show moves made by this LL(1) parser 8
on input " id id id "
E E T | T
T T F | F
F (E) | id
b) Compare SLR, CLR and LALR parser. 6
5. a) Write SDTS and obtain three address code for the following statement. 9
if (P > q and r < = s)
then
u = u * v;
else
u = u/v;
Draw annotated parse tree
KNT/KW/16/7488 1 P.T.O
www.rtmnuonline.com
www.rtmnuonline.com
b) Define:- 4
i) Inherited attribute ii) Synthesized attribute
OR
6. Translate the following code into intermediate code 13
A[i, j, k] = B[i, j] + C[i + j + k]
where A is 3D array of size 10x10x10
B is 2D array of size 10x10
C is 1D array of size 30
Bytes per word = 2
Draw annotated parse tree for the same.
7. a) What are syntactic and semantic errors? Suggest method to recover from these errors. 6
b) Explain phrase level error recovery method for LR parser. 7
OR
8. a) Explain different data structures used for symbol table. Also compares pros and cons of 6
om
each.
e.c
b) What is an activation record? When this record need to be set up? Explain meaning. 7
lin
on
9. a) Explain loop unrolling and jamming with suitable example. 6
nu
m
b) What is reducible flow graph? Explain with example. 4
.rt
c) Write a short note on DAG. w 4
w
w
OR
10. Consider the following flow graph. Compute IN and OUT for the flow graph. 14
B1 a=2
b=a+1
om
e.c
B2 a=1
lin
on
nu
m
.rt
B3 b=b+1
w
w
w
B4 b = b-7
a=a+2
B5
11. a) Generate code for the following expression using labeling algorithm 13
x = (a +b) - (e - (c+d))
OR
12. a) What are the problems in the way of good code generation. 6
b) Explain peephole optimization techniques in detail. 7
**********
KNT/KW/16/7488 2
www.rtmnuonline.com