Canonical LR parser
A
canonical LR parser or
LR(1) parser is an
LR parser whose parsing tables are constructed in a similar way as with LR(0) parsers except that the items in the item sets also contain a
follow, i.e., a terminal that is expected by the
parser after the right-hand side of the rule. Such an item for a rule A -> BC is for example of the form
- A -> B · C, a
which would mean that the parser has read a string corresponding to B and expects next a string corresponding to C followed by the terminal 'a'. LR(1) parsers can deal with a very large class of grammars but their parsing tables are often very big. This can often be solved by merging item sets if they are identical except for the follows, which results in so-called
LALR parsers.
Constructing LR(1) parsing tables
... yet to be written ...