Java Reference
In-Depth Information
1 Start
→
S$
2 S
→
AB
3
|
ac
4
|
xAc
5 A
→
a
6 B
→
b
7
| λ
State 0
Goto
State 3
Goto
Start
→•
S $
4
S
→
a
•
c
6
A
→
a
•
S
→•
AB
2
S
→•
ac
3
S
→•
xAc
1
A
→•
a
3
Figure 6.25: A grammar that is not SLR(
k
).
1 Start
→
S$
2 S
→
A
1
B
3
|
ac
4
|
xA
2
c
5 A
1
→
a
6 A
2
→
a
7 B
→
b
8
| λ
State 0
Goto
State 2
Goto
Start
→•
S $
3
S
→
a
•
c
8
A
1
→
a
•
S
→•
A
1
B
4
S
→•
ac
2
S
→•
xA
2
c
1
A
1
→•
a
2
Figure 6.26: An SLR(1) grammar for the language defined in
Figure 6.25.