Noida Institute of Engineering and Technology, Greater Noida
Noida Institute of Engineering and Technology, Greater Noida
Noida Institute of Engineering and Technology, Greater Noida
B. TECH.
(Semester- V) THEORY EXAMINATION 2020-21
Sub Name: Compiler Design
Note: 1. Attempt all Sections. If require any missing date; then choose suitably.
SECTION-A
SECTION-B
1|Page
a. Discuss the various data structures used for symbol table with suitable example. 10 CO4
b. Explain in detail the process of compilation. Illustrate the output of each phase of 10 CO1
compilation of the input a=(b+c)* (b+c)*2
c. Write short Note on: 10 CO5
i) Loop Unrolling
ii) Loop Jamming
iii) Cross Compiler
iv) YACC Parser
v) LEX Parser
d. Consider the following grammar- 10 CO2
E → E + E | E x E | id
Construct Operator Precedence Parser and also find the Operator Precedence
Functions.
e. Write quadruple, triples and indirect triples for following expression: 10 CO3
(a + b) * (b + c) + (a + b + c)
SECTION-C
S→AxB|Bc
A→yA|z
B→xB|ϵ
b. Write an algorithm for construction of predictive parsing table. Consider the 10 CO2
following grammar and construct predictive parsing table.
S → iEtS / iEtSeS / a
E→b
2|Page
5. Attempt any one part of the following: 1 x 10 = 10
1) i=1
2) j=1
3) t1 = 10 * i
4) t2 = t1 + j
5) t3 = 8 * t2
6) t4 = t3 - 88
7) a[t4] = 0.0
8) j = j + 1
9) if j <= goto (3)
10) i = i + 1
11) if i <= 10 goto (2)
12) i = 1
13) t5 = i - 1
14) t6 = 88 * t5
15) a[t6] = 1.0
16) i = i + 1
17) if i <= 10 goto (13)
a. Define syntax directed translation. Construct an annotated parse tree for the 10 CO3
expression (4 * 7 + 1 ) * 2, using the simple desk calculator grammar.
b. Generate the three-address code for the given switch-case statement. 10 CO3
switch (a+b)
begin
case1: c=d+1
case2: c=d+2
default: c=d+3
end
3|Page
7. Attempt any one part of the following: 1 x 10 = 10
4|Page