[antlr-interest] ANTLR Kudos...

Terence Parr parrt at cs.usfca.edu
Fri Aug 15 09:28:06 PDT 2008


ANTLR will actually figure it out for you, but it can't do so for  
memoization...that can be very expensive on every rule ref.  Well,  
actually only does it if you are backtracking...hmm...maybe it's ok.

Ter
On Aug 15, 2008, at 5:14 AM, Johannes Luber wrote:

> 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