Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Printed Pages:02 Sub Code:KCS-502

Paper Id: 231842 Roll No.

B. TECH.
(SEM V) THEORY EXAMINATION 2022-23
COMPILER DESIGN

Time: 3 Hours Total Marks: 100


Note: Attempt all Sections. If require any missing data; then choose suitably.

SECTION A

1. Attempt all questions in brief. 2 x 10 = 20


(a) How will you group the phases of compiler?
(b) Mention the role of semantic analysis.
(c) What are the various parts in LEX program?
(d) Differentiate Parse tree and Syntax tree with an example.
(e) Give the properties of intermediate representation.
(f) Differentiate between LR and LL parsers.
(g) What is phrase level error recovery?
(h) Discuss the capabilities of CFG.
(i) Define loop jamming.

2
90

13
(j) What is induction variable?
_2

2.
P1

24
SECTION B

5.
3D

.5
2. Attempt any three of the following: 10 x 3 = 30
P2

(a) Write SDD to produce three-address code for Boolean expressions and 17
Q

|1
obtain the three-address code for the statement given below:
7

while a < b do
:2

if c < d then
29

x=y*z
:

else
13

x=y+z
(b) Discuss the stack allocation and heap allocation strategies of the runtime
3
02

environment with an example.


(c) What do you mean by attributed grammars? Discuss the translation
-2

scheme for converting an infix expression to its equivalent postfix form.


01

(d) Construct the NFA and DFA for the following regular expression.
8-

(0+1)*(00+11)(0+1)*
|1

(e) Explain the lexical analysis and syntax analysis phases of the compiler
with a suitable example. Explain the reporting errors in these two phases
as well.

SECTION C

Downloaded from|:18-01-2023
QP23DP1_290 uptukhabar.net
13:29:27 | 117.55.242.132
3. Attempt any one part of the following: 10 x 1 = 10
(a) Construct the CLR parse table for the following Grammar:
ABB
B cB
Bd
(b) Construct the SLR parsing table for the following Grammar.
S→ 0S0
S→ 1S1
S→ 10

4. Attempt any one part of the following: 10 x 1 = 10


(a) What is back patching. Generate three address code for the following
Boolean expression using back patching:
a < b or c > d and e < f
(b) What is top down parsing? What are the problems in top down parsing?
Explain each with suitable example.

5. Attempt any one part of the following: 10 x 1 = 10

2
90
(a) What is an activation record? Draw diagram of general activation

13
record and explain the purpose of different fields of an activation
_2

2.
record.
P1

(b) How do we represent the scope information? Explain scope by number

24
and scope by location.

5.
3D

.5
P2

6. Attempt any one part of the following: 10 x 1 = 10


(a) Define Symbol table? Explain about the data structures used for 17
Q

|1
symbol table.
(b) Explain the following:
7

(i) Copy Propagation


:2

(ii) Dead-Code Elimination


29

(iii) Code Motion


:

(iv) Reduction in Strength.


13
3

7. Attempt any one part of the following: 10 x 1 = 10


02

(a) Explain in the DAG representation of the basic block with example.
-2

(b) Write quadruple, triples and indirect triples for following expression :
01

a = b * – c + b * – c.
8-
|1

Downloaded from : uptukhabar.net


QP23DP1_290 | 18-01-2023 13:29:27 | 117.55.242.132

You might also like