17.5 LR(1) PARSING ALGORITHM
Here is the LR(1) Parsing Algorithm that uses the LR(1) Parse Table with a stack to parse strings. For this stack we do not use a stack start symbol, but instead assume this stack can determine whether it is empty or not. An entry in the LR(1) Parse Table has possible multiple parts including an action (s for shift, r for reduce, g for goto, acc for accept, or e for error), a state, a right-hand side (rhs) of a production, and a left-hand side (lhs) of a production. The functions get(), top(), pop(), and push() were defined in Section 16.2.
LR(1) Parsing Algorithm
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.