15A05601 Compiler Design
15A05601 Compiler Design
15A05601 Compiler Design
PART – B
(Answer all five units, 5 X 10 = 50 Marks)
UNIT – I
2 (a) Show the sequence output of each phase of a compiler for the following code segment:
int x = 5, y = 10,z; z = x+ y*5; printf(“%d”, z);5.
(b) Write a LEX program for a C programming language.
OR
3 (a) Explain about state minimization of finite automata.
(b) Construct NFA and find DFA for a pattern recognition of (a/b)*abb.
UNIT – II
4 Construct CLR parsing for the following grammar:
S→ CC
C→ cC/d
OR
5 (a) What is unambiguous grammar? Give an example for ambiguous grammar.
(b) Write a code for parser generator of an assignment and if-then-else statement.
UNIT – III
6 (a) What is meant by back patching? Show back patching in a Boolean expression.
(b) Discuss various types of three address code representation for the following code segments:
x = x+y*10; z = x;
OR
7 Write SDT to generate intermediate code for assignment statement. Give an example.
UNIT – IV
8 (a) Describe about symbol table organization for block structured language.
(b) Explain how to allocate heap memory space for dynamic memory allocation.
OR
9 (a) Describe about various representations of symbol table.
(b) What is activation record? Explain the structure of an activation record.
UNIT – V
10 (a) What is direct acyclic graph? Explain how this is useful for dataflow analysis.
(b) Describe the following: (i) Common sub expression. (ii) Induction variable elimination.
OR
11 Describe about various peephole techniques with examples.
*****