1
votes

priority:

%nonassoc low
%nonassoc less_than_or_equal less_than equal_operator
%left op_plus op_minus
%left op_multiply op_devision

rules:

expr : expr op_plus expr
| expr op_minus expr
|expr op_multiply expr
|expr op_devision expr
|'~' expr |open_paran expr close_paran |int_val |float_val ;

bool_expr : expr less_than_or_equal expr
| expr less_than expr
|expr equal_operator expr
|NOT bool_expr
|TRUE
|FALSE ;

expression : expr %prec low
|bool_expr;

I get shift/reduce conflict after expr , any idea how to solve it ??

1

1 Answers

1
votes

Add a priority rule for '~' to fix the issue (for example, if '~' is used for negation I would have it associate from the right):

%right '~'