Based on this question Where are the shift/reduce conflicts in this Bison code coming from? I'm trying to create a grammar for a syntax like this:
-10 + 3 - 2
or +4 - 2 + 1
. The first integer obviously has a sign.
This is what I already have:
%token INT
...
Term: INT;
TermOps: "+" | "-";
SignedTerm: TermOps Term | Term;
reminder: /* EPS */ | TermOps TermList;
TermList: SignedTerm reminder;
I know that the rule for SignedTerm
is obviously wrong because it creates ambiguity, but how do I resolve that?