[antlr-interest] executing actions during backtrack

Loring Craymer craymer at warpiv.com
Thu May 11 15:48:22 PDT 2006


Ter--

I like it.  The flag approach has minimal implementation cost, allows
dynamic accumulation of semantics (need actions to compute semantics) in
multi-pass translators, yet allows one-pass processing for friendly
grammars.

--Loring

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Terence Parr
> Sent: Thursday, May 11, 2006 10:42 AM
> To: ANTLR Interest
> Subject: Re: [antlr-interest] executing actions during backtrack
> 
> 
> On May 10, 2006, at 1:46 AM, Loring Craymer wrote:
> 
> > This is really one of those situations where building a solution
> > into ANTLR
> > is probably a mistake: simplicity is a virtue.  As a user, you can
> > always do
> > something like
> >
> > { saveState(); } (synpred) => <grammar fragment>
> > | { recover(); } <alt fragment>
> >
> >
> > if you ever encounter a situation where a rollback is really
> > needed.  I've
> > never seen a case where that was true, although I have done the
> > "wouldn't it
> > be nice" thinking.  Like everyone else, I sometimes try to provide
> > solutions
> > to non-problems and regret it later.
> >
> > Does anyone out there have an example that justifies the
> > implementation
> > effort?  That would probably be good to know before Ter does the work.
> 
> Yep, coming to the conclusion that it's only symbol table stuff that
> needs to go in and that naturally unrolls itself...IF actions are
> executed.  Currently there is no way to specify that an action must
> execute even when backtracking.  That we still need a suggestion
> for.  I almost wonder if it's a global flag like "always exec
> actions" and then if you need a few not-executed, you can manually
> gate with "if ( !guessing )".
> 
> Hmm....
> 
> Ter




More information about the antlr-interest mailing list