| 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.
1 .
2 , a ]
is an LR(1) item or LR(1) configuration for G if
N
1
2 is a production in G and
a
( Vt U
). The symbol `a' is called
the lookahead.
1 .
2, a ]
is valid for 
( Vn U Vt )* if there is a
rightmost derivation
Ssuch that![]()
N omega
![]()
1
2 omega

1 =
and
a
First(omega).
| LR(1) Parsing |