Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

By default Bison will shift when there is a shift/reduce conflict. You can use precedence declarations to change the behavior.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top