You are on page 1of 4

Date:26/12/2022 Enrolment No.

:___________________

RK UNIVERSITY
B.TECH./SEM-VII/SUPPLEMENTARY/DEC-2022

CE705: COMPILER DESIGN

Time: 01:30 PM TO 04:30 PM Total Marks: 100

Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Programmable calculator is not permissible.

SECTION – I

Q.1 (a) Select the most appropriate option: (Each of one mark) 06
1. Which data structure in a compiler is used for managing
information about variables and their attributes?
a. Abstract syntax tree
b. Symbol table
c. Semantic stack
d. Parse table
2. The grammar A->AA | (A) | a is not suitable for predictive parsing
because the grammar is
a. ambiguous
b. left recursive
c. right recursive
d. an operator grammar
3. Which one of the following languages over the alphabet {0, 1} is
described by the regular expression?(0+1)*0(0+1)*0(0+1)*
a. strings with the substring 00
b. strings with at most two 0’s
c. strings with at least two 0’s
d. strings beginning and ending with either 0 or 1
4. _________________ is a top-down parser
a. Operator precedence parser
b. An LALR(k) parser
c. An LR(k) parser
d. Recursive descent parser

Page 1 of 4
5. Which phase of the compiler is also known as Parser?
a. Code optimization
b. Semantic Analysis
c. Syntax Analysis
d. Lexical Analysis
6. A grammar oriented compiling technique known as--------------
a. Syntax directed translation
b. Data flow translation
c. Two pass compiler
d. None of the above.

(b) Answer following questions: (Each of two mark) 10


1. Define the two parts of compilation.
2. Eliminate Left recursion for A-> A + T | T
3. What are the various parts of LEX program
4. What is Finite Automata? Give its types
5. What is an S-Attributed definition?

Q.2 (a) Describe the phases of compiler and apply the analysis phases of 06
compiler for the following assignment statement.
Position := initial +rate * 60
(b) Discuss the need for grouping of phases 05
(c) Write notes on Compiler construction tools 05
OR
Q.2 (a) Discuss the role of Lexical analyser with a neat diagram 06
(b) Convert the regular expression ( a | b ) * abb into NFA 05
(c) What is a shift reduce parser?What are the conflicts in this parser? 05

Q.3 (a) Evaluate predictive parser table and parse the string id +id * id
E ->E+T | T 06
T ->T * F | F
F ->(E) | id
(b) Discuss the role of a parser 06
(c) Discuss about context free grammar. 06
OR
Q.3 (a) Discuss in detail of Inherited Attributes and Synthesized Attributes 06
(b) Write notes on type checking. 06
(c) Discuss the postfix SDT for implementing the desktop calculator 06

Page 2 of 4
SECTION – II
Q.4 (a) Select the most appropriate option: (Each of one mark) 06
1. Which of the following cannot be used as an intermediate code form?
a. Quadruples
b. Syntax trees
c. Three Address Codes
d. Post fix notation
2. Activation record is unit
a. Static memory allocation
b. Heap memory allocation
c. Dynamic memory allocation
d. None of these
3. Peep Hole optimization __________
a. Loop Optimization
b. Local Optimization
c. Constant folding
d. Data Flow analysis
4. DAG representation of a basic block allows _________
a. Automatic detection of local common sub expressions
b. Detection of induction variables
c. Automatic detection of loop variant
d. None of these
5. Match the following:
List-I List-II
A. Lexical analysis 1. Graph coloring
B. Parsing 2. DFA minimization
C. Register allocation 3. Post-order traversal
D. Expression evaluation 4. Production tree
Codes:
ABCD
(a) 2 3 1 4
(b) 2 1 4 3
(c) 2 4 1 3
(d) 2 3 4 1
a. a
b. b
c. c
d. d
6. In the compiler, the function of using intermediate code is:
a. To improve the register allocation
b. To increase the error reporting & recovery.
c. To make semantic analysis easier.
d. To increase the chances of re-using the machine-independent
code optimizer in other compilers.
Page 3 of 4
(b) Answer following questions: (Each of two mark) 10
1. What is Symbol Table? Give usage of Symbol table.
2. Define reference point and evaluation point.
3. What do you mean by run time storage?
4. Define compile time evaluation
5. What do you mean by Peep Hole optimization?

Q.5 (a) Discuss different forms of intermediate code in detail using any 06
example of your choice.
(b) Discuss different storage allocation strategies. 05
(c) Translate the arithmetic expression x = (a + b * c) / (a – b * c) into 05
a. A syntax tree
b. Postfix notation
c. Three Address Code
OR
Q.5 (a) What are the different types of error? How does the compiler handle 06
them? Give an example the concept.
(b) Demonstrate about DAG representation of basic blocks. 05
(c) Describe register allocation in detail. 05

Q.6 (a) Explain code generation design issues. 06


(b) Construct Syntax Tree, Postfix notation and three address code of 06
given expression.
(a+(b*c*d))^d / f –e * 3 / (a + b+ c *3 – 5)
(c) Discuss different code optimization techniques. 06
OR
Q.6 (a) Translate the expression “ -a*b+ -a*b “ into 06
a. Quadruples
b. Triples
c. Indirect Triples
(b) Draw Syntax Tree and DAG for following statement for an 06
expression: [(a+b)*(a+b)+(c+d)]+[(c+d)*(c+d)]. Also write three
address code for the same.
(c) Discuss parameter passing methods in detail. 06

*************

Page 4 of 4

You might also like