CD Model Paper-1

You might also like

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

Total No. of Questions: 8 Total No.

Printed Page: 3
Enrolment No.................. Class Roll No...................

Course: B.Tech Semester: VI


Model Paper-1 (APR - 2023)
Subject Code: CS-603(C)
Subject Name: Compiler Design
Branch: CSE
Time: 03:00Hours MM: 70

Note: i) Attempt any five questions.


ii) All questions carry equal marks.
iii)All parts of each questions to be are attempted at one place.

1. a) Check whether the given grammar is LL(1) or not?

ETE/+TE/ ε
TFT/*FT/ ε
F(E)/id

b) Explain in detail the various phases of compiler with an example.(Analysis-Synthesis


Model of Compilation).
How phases of compilation converts the statement: Position = initial + rate*60.

2. a) Write short note on the following:


i) Symbol Table Management
ii) Top down Vs Bottom up parsing
iii) Predictive Vs Operator precedence parsing
iv) Data structures used in Compilers.
v) Compiler construction tools

b) Explain handle pruning. Explain the same for the grammar E --> E + E / E * E / (E) /
id and input string id l + id2 * id3.

3. a) What is Boot strapping? Also explain Different types of Compilers?


b) Write short note on the following:
i) shift-reduce conflicts
ii) reduce-reduce conflicts
iii) LEX
iv) Input Buffering
v) Canonical items
vi) L-attributes and S-attributes
vii) Ambiguity

4. a) Explain Left Recursion? Eliminate the recursion from the given grammar?

SAa/b
AAc/Sd/f

b) Show that the following grammar is CLR(1) But not LALR(1)?

SAa/bAc/Bc/bBa
Ad
Bd

5. a) Differentiate between simple LR(SLR) AND canonical LR(CLR) with examples?

b) How does an Operator Precedence parser work? Use a pre-constructed operator


precedence table to guide the parsing of an input ‘a+b–20’ using operator precedence
parser.

6. a) Construct the SLR parsing table for the following grammar.


S → L = R/R
L → R/id
R→L

b) What is syntax directed translation? Why are they important?

7. a) What is Syntax directed definitions? Explain various forms of Syntax directed


definitions?

b) Consider the grammar:


E5 + T | 3 – T
T V | V*V | V + V
V a | b
What is the use of left factoring? Find the first and follow for above grammar and do the
left factoring for it.
8. a) What is front end and back end of compiler? What are the advantages of breaking up
the compiler functionality into these two stages?

b) Construct the syntax tree for the expression: a-4+e

You might also like