I have a valid reduce/reduce conflict. Bison selects one rule as a
default one, and it uses the rule when the conflict occurs.
Unfortunately, I need another rule to be the default because it's the
way I like to handle the conflict.
I've tried to change an order of rules within the body of "conflict"
rule, I've tried glr parser and %dprec too, but nothing helps.
Can someone give me a hint how to deal with this? Just a note, I'd like
to keep the grammar as it is as much as possible.
Thanks.
"
%token ID NUMBER
%left '+'
%right UPLUS
%%
body
: body conflict
| conflict
;
conflict
: id
{ /* sem act 1 */ }
// preferred rule but never used
| expr ':' expr
{ /* sem act 2 */ }
;
expr
: '+' expr %prec UPLUS
| expr '+' expr
| NUMBER
| id
;
id
: ID
;
%%
"
--
Zdenek Prikryl
_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison