[antlr-interest] Weird problem with semantic predicates. Incorrect warning message
Gavin Lambert
antlr at mirality.co.nz
Fri May 1 01:36:08 PDT 2009
At 09:51 1/05/2009, Gabriel Petrovay wrote:
>ANTLR could either ignore ambiguous rules (if the computed k is
>toooo large, give up) and proceed with normal computation.
>Another thing ANTLR could do is be to compute k per-rule and
>not per grammar.
k is already computed per-rule, or possibly even per-alt (in v3;
in v2 you had to specify it explicitly). But in cases where ANTLR
can't figure it out it will default to k=1, since that gives the
best performance (if not always the correct result, when the
grammar is ambiguous).
It always helps to try to remove ambiguity and to keep your
grammar as left-factored as possible. This will not only make
ANTLR's job easier, it will also improve runtime performance :)
More information about the antlr-interest
mailing list