17.4 LR(1) PARSE TABLE

The information in the dfa combined with using one lookahead can be stored in an LR(1) Parse Table and then accessed when parsing strings. The LR(1) Parse Table differs substantially from the LL Parse Table. In the LR(1) Parse Table, there are column headings for each aT ∪ {$} ∪ V. We label the columns with the terminals first, then the $, and then the variables. The row headings are the state numbers from the dfa. An entry in the table would have one of five actions: shift, goto, reduce, accept, or error.

We have one action in the table we have discussed but not given a name. The goto action is the second half of a reduce action. A reduce action has two parts. In the first part the right-hand side of a production is ...

Get An Introduction to Formal Languages and Automata, 7th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.