I am trying to write a yacc program which takes up the precedence of its operators from the user and then uses those precedence rules to evaluate an infix expression.
I tried defining the precedence by using character variables beside %left and then assigning these character variables the operator I wanted before calling the yyparse() function. Something like:
%left op1
%left op2
%left op3
%left op4
This failed to work by straight away giving compiling errors and shift/reduce error warnings. I also read about %prec but I don't think I can use that to solve this problem
yacc
can't do this. It's operator precede me is defined statically. – user207421