[antlr-interest] [C Target] Why It is here: if (BACKTRACKING>0)

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Jan 23 10:51:29 PST 2008


On 23/1/08 6:37 PM, "Jim Idle" <jimi at temporal-wave.com> wrote:

Hi Jim,

> The code generating string template does not care whether there is any
> backtracking involved and so any actions or generated code that should
> not be executed if the rule is in backtracking mode are gated in this
> way. It resolves to an int and the C compiler will generate code that
> checks such an expression extremely efficiently such that coupled with
> pipelining and so on, I doubt that you could measure the difference in
> performance without it. I suppose that the template could check this
> kind of circumstance and gate the check in the stringtemplate, but it is
> hardly worth it.
> 
> If you were absolutely sure that the code never does any backtracking,
> then you could change the definition of the macro such that the C
> compiler would always optimize it away. But then you are playing with
> the fundamentals for pretty much zero gain. In general, dont worry
> about the micro optimizations.

So you mean that this code
    
    if (BACKTRACKING>0)
    
Is related NOT only with

    options 
    {
        backtrack    = true;
    }

But to semantic predicates also?  Aha, okay then.
I have think it is only for

        backtrack    = true;


-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the antlr-interest mailing list