[antlr-interest] packrat vs. LL(*)
Steven Obua
steven at obua.de
Mon Jun 8 13:18:52 PDT 2009
>
> With a bit of up front effort it is usually much more time efficient
> (when using ANTLR) to write a good left factored grammar. Please
> remember this statement later when you are trying to track down where
> things are going wrong in your ambiguous grammar :-)
>
I agree that not using backtrack = true and doing left factoring
results in faster and less resource intensive parsing.
Now, what you do is to equal ambiguous with bad. That's why I mention
packrat. With it, you interpret your grammar in a different way (and I
think in a very same way like when you set backtrack=true) which makes
it non-ambiguous. The grammar is actually easier to understand now
than it would be if you were "optimizing" it to suit a particular
parsing technique.
Steven
More information about the antlr-interest
mailing list