It 7 Sem Compiler Design Winter 2018
It 7 Sem Compiler Design Winter 2018
)
Elective-I : Compiler Design
P. Pages : 2 NIR/KW/18/3588
Time : Three Hours *1843* Max. Marks : 80
_____________________________________________________________________
Notes : 1. All questions carry marks as indicated.
2. Solve Question 1 OR Questions No. 2.
3. Solve Question 3 OR Questions No. 4.
4. Solve Question 5 OR Questions No. 6.
5. Solve Question 7 OR Questions No. 8.
6. Solve Question 9 OR Questions No. 10.
7. Solve Question 11 OR Questions No. 12.
8. Due credit will be given to neatness and adequate dimensions.
i) Cross Compiler
b) Construct the parsing table for SLR (1) and test whether the grammar is SLR (1) or not for 8
following grammar :
G = S → PQP
P → aP |
Q → bQ |
}
b) What do you mean by TAC? Represent the following expression into quadruples, triples 7
and indirect triples.
− (a + b) + d + (d (a + b)) + ((a − b) r)
OR
NIR/KW/18/3588 1 P.T.O
6. Give SDTS for array translation. Generate three address code for the statement 13
A[i, j, k] = B[i, j] + C[i + j]
Where
array A is of size 10 20 30
array B is of size 10 20 and
array C is of size 30
assume bpw = 4
b) What is the need of symbol table? Explain the data structure for symbol table management. 7
OR
b) What are the principle sources of optimization? Also write importance of code optimization. 7
OR
i=2
B1
j=j+1
I= 1
B2
j=j+1 B3
B4 j=j-4 j=j+2 B5
b) Write the steps of algorithm for partitioning a sequence of three – address statements into 7
basic blocks.
NIR/KW/18/3588 2