VTU Computer Science (Semester 6)
Compiler Design
June 2014
Total marks: --
Total time: --
INSTRUCTIONS
(1) Assume appropriate data and state your reasons
(2) Marks are given to the right of every question
(3) Draw neat diagrams wherever necessary


1 (a) Explain the various phases of a compiler with the help of neat diagram.
8 M
1 (b) Give the formal definitions of operations on languages with notations.
4 M
1 (c) Write the transition diagram to recognize the taken below:
i) relop (relational operations)
ii) unsigned number.
8 M

2 (a) Give the rules for constructing FIRST and FOLLOW sets.
6 M
2 (b) Construct the predictive parsing table by making necessary changes to the grammar given below:
E → E+T|T
T → T*F|F
F → (E) |id
10 M
2 (c) Give the formal definition of CFG with an example.
4 M

3 (a) What is a shift ? reduce parser? Explain the conflicts that may occur during shift-reduce parsing. List the actions of shift reduce parser.
6 M
3 (b) Form the Action / Goto table for the following grammar:
S → Aa bAc| Ba | bBa
A → d
B → d
Justify whether the grammar is LR(0) or not.
14 M

4 (a) Construct the canonical LR(1) item sets for the following grammar:
S → AA
A → aA|b
10 M
4 (b) Construct LALR parsing table for the grammar shown in Q4 (a) using LR(1) items.
10 M

5 (a) Define inherited and synthesized attributes. Given examples.
6 M
5 (b) Given the SDD for simple desk calculator and draw dependency graph for expression. 1*2*3*(4+5)n
10 M
5 (c) Write SDD that generates either a basic type or an array type.
4 M

6 (a) Draw the DAG for the expression, a+a*(b-c)+(b-c)*d. Show the steps for constructing the same.
10 M
6 (b) Explain the following with examples: i) Quadruples ii) Triples.
6 M
6 (c) Write the three address code for the expression: a+a*(b-c)+(b-c)*d
4 M

7 (a) Give the general structure of an activation record. Explain the purpose of each component.
8 M
7 (b) Explain the performance metrics that must be considered while designing garbage collector.
8 M
7 (c) Give the memory hierarchy configurations of modern computer highlighting size and acces times.
4 M

8 (a) Explain the main issues in code generation.
10 M
8 (b) For the following program segment:
for i=1 to 10 do
for j=1 to 10 do
a[i, j]=0.0
for i=1 to 1o do
a[i, j]=10
Generate intermediate code and identify basic blocks.
10 M



More question papers from Compiler Design
SPONSORED ADVERTISEMENTS