I am using Grako. In my EBNF grammar, I have an expression that consists of a lot of subexpressions that are concatenated using the OR-operator, like so:
expression = subexpressionA | subexpressionB | ... | subexpressionZ;
The parsing process always fails if the input string contains one of the latter subexpressions, say subexpressionZ. When I rewrite the grammar like this
expression = subexpressionZ | subexpressionB | ... | subexpressionA;
the parsing process finishes successfully if the input string contains subexpressionZ but will now fail if it contains subexpressionA.
Has anyone ever had a similar problem? Is that a bug in Grako (I am using 3.6.3.) or am I doing something wrong?
Thanks a lot for any ideas!
I solved my problem - a long time ago :) - by splitting up the expressions in a number of sub-expressions like so:
expression1 = subexpressionA | subexpressionB | subexpressionC;
expression2 = subexpressionD | subexpressionE | ... | subexpressionZ;
expression = expression1 | expression2;
For some reason, this works...