SRM UNIVERSITY, KATANKULATHUR - 603203
SOFTWARE ENGINRING
Principles of Compiler Design Sub_code : CS0352
Class : VI SEM SWE
PART-A Answer all 10x2 = 20 marks Max :100 marks
1) What are the functions of preprocessors?
2) Define a symbol table.
3) What is an ambiguous grammar? Give an example.
4) Define LR Parsing?
5) What are the various methods of implementing three address statements?
6) What are basic blocks and flow graphs?
7) what is an activation tree?
8) What are the steps involved in partitioning a sequence of three address statements into basic
blocks?
9) What are the limitations of static allocation?
10) What is a control stack?
PART-B Answer all 5x16 = 80 marks
11) (a) With a neat block diagram ,explain the various phases of a compiler in detail. Assuming
an expression,give the output of each phase. (16)
OR
(b) (i) Give a minimized DFA for the following expression (a|b)*abb. (10)
(ii) Draw the transition diagrams for an identifier and an unsigned number (6)
12) (a) (i) Give an algorithm for finding FIRST and FOLLOW positions for a given
nonterminal. (4)
(ii) Consider the grammar
E TE'
E' --> +TE' |
T --> FT'
T' --> *FT' |
F --> (E) | id
Construct a predictive parsing table for the grammar given.
Verify whether the input string id + id * id is accepted by the grammar or not. (12)
OR
(b) (i)Give the LALR parsing table for the grammar
S --> L = R | R
L --> *R | id
R --> L (12)
(ii) compare the different LR parsing techniques (4)
13) (a) (i) Explain about different types of three address statements. (8)
(ii) What are the methods of translating boolean expressions. Give an example (8)
OR
(b) (i) What is backpatching? Explain with an example. (8)
Explain procedure calls with an example. (8)
14) (a) (i) Construct a DAG for the following basic block (6)
d := b*c
e := a + b
b := b*c
a:= e - d
(ii) Explain in detail about primary structure preserving transformations
on basic blocks. (10)
(OR)
(b) (i)Explain in detail about a simple code generator with the appropriate algorithm (8)
(ii)Explain in detail about run-time storage management (8)
15) (a) (i) Explain in detail principal sources of optimization. (10)
(ii) Describe in detail about optimization of basic blocks with an example. (6)
(OR)
(b) (i) Explain in detail storage allocation strategies (10)
(ii)Write short notes on parameter passing (6)
--------------------------------------------------------------------------------------------------