My grammar has these two token declarations:
%token RP
%token ELSE
And these two rules:
Statement : IF LP Exp RP Statement;
Statement : IF LP Exp RP Statement ELSE Statement;
From what I understand, a rule's priority is determined by the priority of its last nonterminal. Therefore, the first rule has RP
priority and the second rule has ELSE
priority which is higher than RP
. Below is bison's output:
state 73
11 Statement: IF LP Exp RP Statement .
12 | IF LP Exp RP Statement . ELSE Statement
ELSE shift, and go to state 76
ELSE [reduce using rule 11 (Statement)]
$default reduce using rule 11 (Statement)
Shouldn't this conflict be solved by shifting since ELSE
has higher priority ?