qwerty
qwerty

Reputation: 546

How to get rid of reduce-reduce bison

my code is the following:

%%
%token blablabla
%%

expresion:  operand
            operand '-' expresion
           |operand '+' expresion
           | '(' expresion ')'  /*Conflict line*/
;

/*terminal symbols */operand: IDENTIFIER                { printf (" %s ", $1) ; } 
                             | NUMBER                   { printf (" %s ", $1) ; }
       ;

I get 3 reduce/reduce warnings when compiling (even though the code runs correctly). How can I get rid of these warnings?

Upvotes: 0

Views: 128

Answers (1)

user3344003
user3344003

Reputation: 21617

Methinks you want

     %left '-' '+'


     expression : operand
                 | expression '-' expression
                 | expression '+' expression
                 | '(' expression ')'

Upvotes: 1

Related Questions