![]() | ![]() | ![]() | LR(1) Parsing |
E
( L , E )
E
S
L
L , E
L
E
S
ident
S
( S )
The state reached on input `( S' contains an SLR(1) conflict but 1 symbol look ahead is enough to allow us to parse.
To see why, build the LR(0) machine. The conflict is between
the items [ S
( S . ) ] and [ E
S . ]
and ")" is clearly in the Follow set of E.
However, if one reduces using the production in the reduce item,
one would quickly ends up in a state where you further reduce
the E to an L. Then, you end up in a state where the only
possible action is to shift in a comma. So, if the next input
is not a comma, reducing by E
S is a dead end.
Ssuch that![]()
N omega
![]()
1
2 omega
![]() | ![]() | ![]() | LR(1) Parsing |