[antlr-interest] Way to "cut" parsing?

Loring Craymer lgcraymer at yahoo.com
Tue Oct 16 21:50:45 PDT 2012


I'll add one comment on the issue of syntactic predicates.  Inserting predicates during early development to get something running is not bad practice (in fact, judicious insertion at this time should be encouraged--it shortens the time to having a working grammar), but failure to refactor a grammar to remove as many of these as possible is.  If you think that you might have been heavy handed with inserting predicates, you probably have not spent much effort at removing them.  Spending time refactoring a grammar is almost always a win, not only for error reporting, but also for performance (synpreds are expensive) and extensibility.

--Loring




>________________________________
> From: Jim Idle <jimi at temporal-wave.com>
>To: antlr-interest at antlr.org 
>Sent: Tuesday, October 16, 2012 7:39 PM
>Subject: Re: [antlr-interest] Way to "cut" parsing?
> 
>You may or may not need catch clauses - usually you do not. You will almost
>certainly need to influence error recovery by adding the empty rule to do
>some magic token eating though, as this is what keeps antlr within the inner
>rules as long as possible.
>
>jIM
>
>-----Original Message-----
>From: antlr-interest-bounces at antlr.org
>[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Juancarlo Añez
>Sent: Wednesday, October 17, 2012 5:58 AM
>To: antlr-interest at antlr.org
>Subject: Re: [antlr-interest] Way to "cut" parsing?
>
>Jim,
>
>Without backtracking, then the techniques I explain in the article I sent to
>> you will work for this. Give it a try.
>>
>
>Will do. Just to be sure, what I have to do is to add a *catch* clause to
>the rules in which I want parsing to be cut, and customize recovery (or
>remove recovery) there. Right?
>
>
>> You may also be using to heavy handed
>> lookaheads. A lot of people will write:
>>
>
>> (rule)=>rule when they in fact only need (X|Y|Z)=>rule
>>
>
>Guilty as charged! I will look into that too.
>
>Thanks!
>
>--
>Juancarlo *Añez*
>
>List: http://www.antlr.org/mailman/listinfo/antlr-interest
>Unsubscribe:
>http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>List: http://www.antlr.org/mailman/listinfo/antlr-interest
>Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
>


More information about the antlr-interest mailing list