Thanks, Marcin. I am walking thru the returned tree to do the
evaluation instead. This seems to be cleaner.

Charles


On Fri, May 14, 2010 at 3:23 PM, Marcin Rzeźnicki
<[email protected]> wrote:
> On Fri, May 14, 2010 at 6:25 PM, Charles Chan <[email protected]> wrote:
>> Hi, all. I have a parser optimization question for you guys. In my
>> grammar (below), I have to evaluate an OR condition and an AND
>> condition. We all know that "true OR true/false" is always true and
>> "false AND true/false" is always false. So, technically, if I can skip
>> evaluating RHS under those conditions.
>>
>> Is there a way for me to incorporate this kind of optimization in my
>> grammar? Currently, I am retrieving the values from a Map so that
>> performance is okay but I plan to retrieve them from DB, so any
>> optimization to skip the retrieval process would be great.
>>
>> Any idea?
>>
>
> Sync to follow set if you have simple rules, where no element of
> follow can possibly be present within the rule you're escaping from.
> In your case you can freely sync to ';' so that should solve your
> problems. In any case you can define special flag, like SKIPPING_STATE
> = 10000; - set backtracking state to this value so you know that you
> are escaping and continue with parsing, no actions will be taken so
> you should be fine with this solution to. Just remember to unset
> backtracking state on exit.
>
>
> --
> Pozdrawiam
> Marcin Rzeźnicki
>

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to