|
![]() |
5.2.5 LR-Family: LR(1) Table GenerationAn LR(1) item is and LR(0) item plus a set of lookahead characters. E indicates that we have seen an E, and are expecting a "+T", which may then be followed by the end of string (indicated by $) or by a "+" (as in a+a+a). The algorithm is the same as for creating LR(0) items except the closure step which now needs to be modified to include the lookahead character: Closure: IF A We build the first two states here and leave the remaining (21) to the reader: State 0: E' Applying the closure rule to this gives us initially E State 0 State 1
LALR(1) parsers parse fewer languages than do LR(1) parsers. |