I have a situation where there is a rule with a shift/reduce conflict that i understand. I want a rule to never reduce until at the last moment possible (end of line). So I would like to say always shift. How do i do this?
+1
A:
By default Bison will shift when there is a shift/reduce conflict. You can use precedence declarations to change the behavior.
Craig
2009-12-05 07:50:19
i heard this before but i still dont like seeing a warning or error about shift/reduce or reduce/reduce. ATM its disabled because its syntax sugar.
acidzombie24
2009-12-05 08:50:55
+2
A:
As Craig notes, when there's a shift reduce conflict, bison does the shift. If the warning about it bothers you, you can use bison's %expect directive to specify the expected number of shift-reduce conflicts. This way it will be silent if that's the only conflict, but if there are additional conflicts, the warning will come back.
Chris Dodd
2009-12-07 22:26:46
I prefer an alternative but this answer does get rid of the messages. I would like to rewrite the section so it knows to shift and not reduce but i cant wrap my head around how i might do that. (maybe its not worth it ATM. I'll see when i get to the end). btw mentioning %expect-rr for hiding the reduce/reduce conflicts
acidzombie24
2009-12-08 08:28:18