P13CS63 - Ii
P13CS63 - Ii
1
U.S.N
Contd….2
P13CS63 Page No... 2
c. Consider the following grammar :
E → E +T /T
T →T *F / F 5
F → ( E ) / id
Define left recursion and eliminate left recursion from the original grammar.
UNIT - III
5 a. Construct SLR parsing table for the following grammar :
S → CC
10
C → cC
C→d
b. Explain :
i) Handle pruning ii) Shift-reduce conflict 10
iii) Reduce-Reduce conflict iv) Shift-reduce parser.
6 a. Construct Canonical LR( ) set of items for the following grammar :
S → Aa / bAc / Bc / bBa
12
A→d
B→d
b. How error recovery is done is LR parsing? Explain with examples. 8
UNIT - IV
7 a. Write Syntax Directed Definitions (SDD) for the following grammar and hence, construct
annotated parse tree for the expression :
( 4 + 3) * ( 5 + 6 ) n
Grammar:
L → En 10
E → E +T
E →T
T →T *F
T →F
F → ( E ) / digit
Contd….3
P13CS63 Page No... 3
UNIT - V
9 a. Explain the different ways of representing 3-address code statements. Represent the
following expression in the ways 10
− ( a + b) *(c + d ) + ( a + b + c).
(( x + y ) − (( x + y ) * ( x − y ))) + (( x + y ) * ( x − y )).
5
****