Simple LR parser: Difference between revisions

Content deleted Content added
m Example: Cleaned up using AutoEd
No edit summary
Line 43:
The action and goto tables:
 
{| borderclass="1" align="centerwikitable"
|- align="center"
| || colspan="2" |''action''||''goto''
Line 59:
 
As can be observed there is a shift-reduce conflict for state 1 and terminal '1'. This occurs because, when the action table for an LR(0) parser is created, reduce actions are inserted on a per-row basis. However, by using a follow set, reduce actions can be added with finer granularity. The follow set for this grammar:
{| borderclass="1" align="centerwikitable"
|- align="center"
| symbol||S||E||1
Line 79:
By using mustBeAdded on each reduce action in the action table, the result is a conflict-free action table:
 
{| borderclass="1" align="centerwikitable"
|- align="center"
| || colspan="2" |''action''||''goto''