bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

a rule is breaking an unrelated rule with no conflicts


From: Adam Smalin
Subject: a rule is breaking an unrelated rule with no conflicts
Date: Mon, 9 Dec 2013 23:22:32 -0500

I don't fully understand this but i'll try to describe it

My rules are similar to the below

body:
    recursive-expr //rval + rval, rval = rval, etc
  | rval '=' rvalLoop
//  | rval ',' rval '$' '$' '$' //nonsense here to show the problem

rvalLoop:
    rval
  | rvalLoop ',' rval

In my test file when I do "var = 5, 6" it works fine. When I uncomment the
nonsense line my parser broke.

THE CRAZY THING IS I still have 0 shift/reduce and 0 reduce/reduce errors.

I searched "rval '=' rval ." in my conflict file and I see this

  270     | rval '=' rval .  [..., ',', '}', '\n']
rvalLoop: rval . ',' rval

Conflict between rule 270 and token ',' resolved as reduce (',' < '=').

It seems to have decided to never use rvalLoop in this situation. The weird
thing is the nonsense line has nothing to do with it.

Removing the nonsense line or making ',' a higher (or lower?) than '='
fixes the problem. The nonsense line is a real line I made into nonsense
just to see what would happen. Changing the comma precedence order would
break things and my real rule triggers the problem in this nonsense rule.
The parser reports no conflicts

Whats going on here? How do I fix it?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]