Closed qawbecrdtey closed 5 years ago
I think it will work if you remove the must
rule in both add
and subtract
. It causes a failure of add
to be converted into a global failure, but you want a local failure in order to use back tracking in your sor
Thanks @nshcat ! I must have misunderstood the rule reference "Allows local failure of R...
even within must<>
etc."
@qawbecrdtey The part of the rule reference that you quoted is indeed easy to misunderstand, we removed the offending occurrences of that sentence.
I am making a simple parser with grammar where
n
,{e + e}
, and{e - e}
are expressions. I wrote a code like:The program works well with input like
{{1 + 2} + {3 + 4}}
, but it will return an errorparse error matching Example::(anonymous namespace)::plus
whenever I put a-
in the string. I think the error appears instruct expression
sincesubtract
appears afteradd
insor
, but I can't find a way to fix this problem. Would anyone give me advice with this? Also, it would be nice if anyone could give me a way to actually calculate the expression.