Encyclopedia > Canonical LR parser

  Article Content

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 socalled LALR parsers.

Constructing LR(1) parsing tables

... yet to be written ...



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Grand Prix

... dumped 2003-03-17 with ...

 
 
 
This page was created in 25.2 ms