THE ICFAI UNIVERSITY TRIPURA
EXAMINATION DEPARTMENT
COMPREHENSIVE EXAMINATION, SEM II, AY-2022-23
PROGRAM: 3rd YR B.Tech CSE FULL MARKS: 50
COURSE TITLE: Compiler Design COURSE CODE: CSE326T
*******************************************************************************************************
SECTION- A
Answer the following:
1. Write the difference between syntax tree and parse tree.
2. What are the conflicts may occur in bottom up parsing?
3. Represent the following expression using DAG
z + z * (x – y) + (x – y) * p
4. Write a regular expression for a language containing strings which end with “xyy”
over Ʃ= {x,y}.
5. What is the function of symbol table?
SECTION-B
Answer Any Four of the following:
6. Discuss the advantages and disadvantages of LR parser and operator precedence
parser.
7. Write the quadruples and triples for the expression
X= (a+b)/(a*b)*(g+h)-d
8. Find the Leading and Trailing for the following grammar with details
A A+B/B
BB*C/C
C (A)/id
9. Give the rules for computation of FIRST(X) and FOLLOW(X). Construct FIRST
and FOLLOW sets for the following grammar.
S → aBDh
B → cC
C → bC / ∈
D → EF
E→g/∈
F→f/∈
10. Explain S-attributed and L-attributed SDD
SECTION-C
Answer Any Two of the following:
11. What is code optimization? Explain machine dependent and independent code
optimization with proper example. [2 +8]
12. a. Design a SDD to create a parse tree. [4]
b. Construct the LR(1) parsing table for the following grammar [6]
Page-1
E –> E + T | T
T –> (E) | id
13. Write the rules to identify loop using Basic Block and program flow analysis. Find
the basic block for the following three address code [4+6]
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)
*****
Page-2