
104 Compilers – Principles and Practice
c
The look-ahead symbol is carried along to help choose the correct reduction.
c
Look-aheads are for bookkeeping, unless item has a “dot” at the right-hand end.
• It has no direct use in [A → B i C, a]
• In [A → B C i , a], a look-ahead of ‘a’ implies a reduction by A → BC.
• For a state having items [A → B C i , a] and [C → D i E, b], if look-ahead seen is ‘a’ then
reduce to A, if the look-ahead is in FIRST(E) then shift.
• Thus comparatively limited right context is enough to pick up correct action.
• If we have two LR(1) items of the form [A → C i , a] and [B → C i , b], we can take advantage ...