[antlr-interest] ANTLR Kudos...

Johannes Luber jaluber at gmx.de
Fri Aug 15 05:14:40 PDT 2008


Ian Kaplan schrieb:
> 
> 
>     /
>     Performance is not bad with backtracking and memoization; linear
>     time cost.  Still better to let ANTLR predict with a simple DFA
>     rather than backtracking.  Also can set backtracking per rule./
> 
> 
> 
>        Only a part of my grammar requires more than two symbols of look 
> a head.  How do you turn on backtracking on a per rule basis?  I've got 
> it set globally and it may not need to be.

You can put an options block into a rule definition like so (didn't test 
it, so syntax may be a bit off):

rule
options {
backtracking=true;
memoize=true;
}
: otherRule;

Johannes

> 
>   Thanks,
> 
>   Ian
> 



More information about the antlr-interest mailing list