This is a 20 years old language with zillions of existing lines of code. If I
can get the parser to work even with an awful lot of backtracking then I can
use it to write a translator that cleans up those kind of stupid idioms...
I think your answer gave me the clue I needed though, apparently
backtracking works between alternatives but consuming or not consuming one
instance of a ( )* construct is not considered an alternative. If I replace
the * construct with tail recursion in my example things work fine - I need
to see if that is something I can do in the real grammar.
So my grammar works fine in this form (rest unchanged):
program
: statement* EOF
;
statement
: ID '=' expr
| sep
;
expr : ID suffix;
suffix : DOT expr
| /* nothing */
;
--
View this message in context:
http://antlr.1301665.n2.nabble.com/Confused-about-backtracking-tp7033712p7039813.html
Sent from the ANTLR mailing list archive at Nabble.com.
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.