[antlr-interest] Option backtrack=true
Stephanie Balzer
stephanie.balzer at gmail.com
Tue Jan 15 14:38:55 PST 2008
Hi all,
I am new to ANTLR and use ANTLRWorks to develop a compiler for my
programming language. I based my grammar on the Java 1.5 grammar for ANTLR
v3. Thus, I took over the options
k=2; backtrack=true; memoize=true
With above options, I was able to generate the parser successfully. However,
when I started debugging some programming language statements/expressions
the parser seemed to simply ignore some of the rules and didn't produce the
result I expected. I guess this has to do with the syntactic predicates that
are assigned to productions.
Now my questions:
- What does this option actually mean?
- Is it advisable not use the backtracking option?
- If I use the backtracking option, how can I influence these predicates?
I also tried to remove the backtracking option. In this case, however, I get
a lot of warnings when generating the parser. To resolve these warnings I
started to left factor my rules. But this seems to be a endless story!
So, another question:
- Is left factoring the only solution to deal with the warnings (besides
enabling backtracking)?
Thanks a lot for your help!
Stephanie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080115/78e807e1/attachment.html
More information about the antlr-interest
mailing list