0% found this document useful (0 votes)
36 views2 pages

Compiler Set2

This document contains a comprehensive examination for a Compiler Design course. It is divided into three sections. Section A contains short answer questions about the differences between syntax trees and parse trees, conflicts in bottom-up parsing, representing an expression as a DAG, and the purpose of a symbol table. Section B contains longer answer questions about LR and operator precedence parsers, generating triples and quadruples from an expression, grammar properties, and FIRST and FOLLOW sets. Section C contains even longer answer questions about code optimization techniques, designing an SDD to create a parse tree, constructing an LR(1) parsing table, and identifying loops using basic blocks and program flow analysis.

Uploaded by

techstudio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views2 pages

Compiler Set2

This document contains a comprehensive examination for a Compiler Design course. It is divided into three sections. Section A contains short answer questions about the differences between syntax trees and parse trees, conflicts in bottom-up parsing, representing an expression as a DAG, and the purpose of a symbol table. Section B contains longer answer questions about LR and operator precedence parsers, generating triples and quadruples from an expression, grammar properties, and FIRST and FOLLOW sets. Section C contains even longer answer questions about code optimization techniques, designing an SDD to create a parse tree, constructing an LR(1) parsing table, and identifying loops using basic blocks and program flow analysis.

Uploaded by

techstudio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

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
BB*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

You might also like