If I have a grammar where a certain expression can match two productions, I will obviously have a reduce/reduce conflict with yacc. Specifically, say I have two productions (FirstProduction and SecondProduction) where both of them could be TOKEN END
.
Then yacc will not be able to know what to reduce TOKEN END
to (FirstProduction or SecondProduction). However, I want to make it so that yacc prioritises FirstProduction
in this situation. How can I achieve that?
Note that both FirstProduction
and SecondProduction
could be a great deal of things and that Body
is the only place in the grammar where these conflict.
Also, I do know that in these situations, yacc will choose the first production that was declared in the grammar. However, I want to avoid having any reduce/reduce warnings.