You are on page 1of 1

Department of Information Technology

Question Bank for Unit Test-2


Subject: Compiler Design Session 2023-24
Unit-III & IV
1. Consider the following grammar:
a. SL=R|R
b. L*R|id
c. RL
a. Construct Augmented Grammar
b. Collect canonical sets of LR(1) items & obtain the parsing table
c. and show the stack implementation for the string *id=id
2. Consider the following grammar.
i. E→E+T|T
ii. T→T*F|F
iii. F→id
a. Construct the augmented grammar
b. Collect the canonical collection of sets of LR(0) items & obtain parsing table.
c. show stack implementation of string id*id+id
3. Explain the conflicts in LR parser.
4. Differentiate between top down and bottom up parser.
5. Construct an LALR parsing table for the grammar.
S→CC
C→cC|d
6. Write & explain syntax directed definition (SDD) for simple desk calculator. What
would be the parse tree for 1*2+3n.
7. Explain syntax directed definition and translation scheme. Also explain types of
attributes.
8. Consider the following grammar for simple type declaration

D TL

T int|real

L L, id|id

Construct the parse tree and dependency graph for the input string real x, y, z

9. Draw dependency graph for given grammar & write SDD.


T F T’
T’*F T1’
T’ €
F digit

You might also like