Professional Documents
Culture Documents
If [A→α.] is in Ii then set action [i, a][ to “reduce A→ α] for all a in FOLLOW(A), here A
may not be S’ Differen Difference between Machine
If [S’ → S.] is in Ii, then set action[i, $] to “accept” ce Dependent and Independent
between Code Optimization
If any con icting actions are generated by the above rules, we say the grammar is not
Machine November 20, 2017
SLR(1). The algorithm fails to produce a parser in this case.
The goto transitions for state I are constructed for all non-terminals A using the rule: if
goto(Ii, A) = Ij, then goto[i, A] =j TECHNOLOGY
All entries not de ned by rules (2) and (3) are made “error”
The initial state of the parser is the one constructed from the set containing item [S’ → S] 3/Web Technologies/post-list
Number of productions in the grammar from onwards and use the production number
while making a reduction entry
CATEGORIES
For example for the given grammar
1. E → E + T Arithmetic 7
2. E → T
Compiler Design 74
3. T → T * F
4. T → F COMPUTER PROGRAMMING IN C 49
5. F → ( E )
OOAD MCQ 9
6. F → id
OOAD Notes 63
This construction requires FOLLOW of each non-terminal present in the grammar to be computed
Web Technologies 71
The grammar that has a SLR parsing table is known as SLR(1) grammar. Generally, 1 is omitted
I1:
E’ → E.
E → E.+ T
I2:
E → T.
T → T .* F
I3:
T → F.
I4:
F → (.E)
E→.E+T
E → .T
T → .T * F
T → .F
F → .( E )
F → .id
I5:
F → id.
I6:
E → E + .T
T → .T * F
T → .F
F → .( E )
F → .id
I7:
T → T * .F
F → .( E)
F → .id
I8:
F → ( E .)
E → E. + T
I9:
E → E + T.
T → T. * F
I10:
T → T * F.
I11:
F → ( E ).
COMPILER DESIGN
NEWER OLDER
SEND