Notes on LALR parse table
. Modified parser behaves as original except that it will reduce C
d on inputs like ccd. The error will eventually be caught before any more symbols are shifted.
. In general core is a set of LR(0) items and LR(1) grammar may produce more than one set of items with the same core.
. Merging items never produces shift/reduce conflicts but may produce reduce/reduce conflicts.
. SLR and LALR parse tables have same number of states.
Canonical parser will catch error as soon as it is encountered, since it manages a state for each possible look-ahead, but on the other hand LALR parser does not distinguish between the possible lookaheads. Consider the example, where the grammar accepts c*dc*d. Suppose the parser is given input ccd. While canonical parser will exit with error status as soon as it sees d, because it does not expect $ to be seen after first d. On the other hand, LALR parser will first reduce C
d, but will eventually report an error.
It does not produce shift/reduce conflict since it keeps track of possible look-ahead symbol (not whole follow set) and hence is able to find when a reduction is possible. But since we are not managing each of the different look-ahead, reduce/reduce conflicts can not be avoided