I have a question about operator precedence and associativity in Bison.
In every example I see the productions are like expr 'op' expr
, for example :http://dinosaur.compilertools.net/bison/bison_8.html
But if I would use bison %left
and others associativity tools, and I would use grammar like:
expr| expr binop expr
| expr relop expr
| expr logical_op expr
and
binop: '+'
| '-'
| '*'
| '/'
;
relop: EE
| NE
| LE
| '<'
| GE
| '>'
;
logical_op: AND
| OR
;
would associativity and precedence rules be used?
Or do I need to write explicite expr 'op' expr
for every operator?
I am asking, because when I try to use the grammar like the one I posted I get warnings about conflicts.
But when by hand I write productions like expr '+' expr
I am not getting any warnings.