February 2022
Beginner to intermediate
572 pages
13h
English
Given a context-free grammar G, if you can build the LR(1) Parse Table that uses one lookahead, and the resulting table has no conflicts in any entries, then G is an LR(1) grammar. If the grammar is not LR(1), then in at least one entry in the table, there would be more than one action.
A shift-reduce error means that for the same lookahead there is a shift operation and also a reduce operation. For example, in Figure 17.10(a), q1 or 1 is the state. Then LR[1, c] has a shift operation for the item A → c · cA. If c ∈ FOLLOW(A), then LR[1, c] also has a reduce by item A → c·, resulting in a shift-reduce conflict.

Read now
Unlock full access