Semester : SEMESTER 6
Subject : Compiler Design
Year : 2019
Term : DECEMBER
Branch : COMPUTER SCIENCE AND ENGINEERING
Scheme : 2015 Full Time
Course Code : CS 304
Page:2
12
13
14
15
16
17
18
19
20
a)
b)
a)
b)
a)
b)
a)
b)
a)
b)
a)
a)
a)
b)
a)
b)
F192029 Pages:2
PART (^
Answer all questions, each carries3 marks.
Compute FIRST and FOLLOW for the grammar:
S -> SS+| SS* |
Write the algorithm to construct LR(1) collection for a grammar.
What is an SDD? Show an example.
Distinguish between synthesized and inherited attributes.
PART D
Answer any two full questions, each carries9 marks.
Write algorithm for SLR paring table construction.
Construct syntax directed translation scheme for infix to postfix translation.
Construct the SLR table for the grammar:
ऽ -> aSbS|a
Give the annotated parse tree for the expression: 1*2*3*(4+5) n
Differentiate CLR and LALR parsers.
Explain the specification of a simple type checker.
PART E
Answer any four full questions, each carries10 marks.
Explain how DAGs help in intermediate code generation?
Explain the code generation algorithm. Illustrate with an example.
Define the following and show an example for each.
i). Three-address code 111). Triples
ii). Quadruples iv). Indirect triples
State the issues in design of a code generator.
Explain different stack allocation strategies with suitable examples.
Explain different code optimization techniques available in local and global
optimizations?
How is storage organization and management done during runtime?
How the optimization of basic blocks is done by a compiler?
Write the algorithm for partitioning a sequence of three-address instructions into
basic blocks.
Construct the DAG and three address code for the expression ata*(b-c)+(b-c)*d
Page 2 of 2
(3)
(3)
(3)
(3)
(5)
(4)
(5)
(4)
(4)
(5)
(4)
(6)
(6)
(4)
(10)
(10)
(4)
(6)
(4)
(6)