My rules are similar to the below
body:
recursive-expr //rval = rval is here
| rval '=' rvalLoop
// | rval ',' rval //problem line
rvalLoop:
rval
| rvalLoop ',' rval
In my test file when I do "var = 5, 6" it works fine. When I uncomment the
problem line my parser breaks. The problem is that line introduces ',' to
recursive-expr. Without the comma the parser would shift into rvalLoop
because comma doesn't lead to any other state. Now with the problem line
the parser sees the ',' is lower than '=' and reduces instead of shifts
which breaks the parser.
How do I tell it to shift in this case? I tried writing "%token
OVERRIDE_PREC" and "%left OVERRIDE_PREC" at the bottom of my %left/%right
directives. Then I used %prec OVERRIDE_PREC on the non recursive-expr lines
but it appears to not have worked.
_______________________________________________
[email protected] https://lists.gnu.org/mailman/listinfo/help-bison