[antlr-interest] Understanding non LL(*) errors
franck102 at yahoo.com
Thu Nov 24 14:47:42 PST 2011
Made some progress after lots of head scratching and re-reading the antlr
1. I saw somewhere on a popular antlr web page that syntactic predicates
could only appear at the beginning of an alternative, this is inaccurate, in
fact my problem is solved by adding a predicate at the beginning of a ( )*
subrule (see below)
2. I found the "methodology" I was looking for, simply add a global
backtrack=true option, parse a few inputs that you suspect are trouble
makers and look at the parse tree which shows the backtracking in green &
red - much much easier for me to figure things out that way for recursive
Still not too sure about the performance impact of my predicate, but
hopefully looking at the parse tree for some complex inputs should give me
an indication since apparently it also shows the predicate evaluations in
green or red?
Refactoring seems at least as attractive but much harder to do right, and
without ending up with a useless AST.
Congratulations on the antlrworks tool, it is a life saver for inexperienced
grammar designers like me!
program : callExpression ( ',' callExpression )*;
| 'call' primaryExpression ( ( ',' primaryExpression )=> ','
: '(' callExpression ')'
View this message in context: http://antlr.1301665.n2.nabble.com/Understanding-non-LL-errors-tp7027459p7029627.html
Sent from the ANTLR mailing list archive at Nabble.com.
More information about the antlr-interest