[antlr-interest] Predicate Question...

Loring Craymer lgcraymer at yahoo.com
Mon Nov 6 23:12:54 PST 2006


Rob--

For v2, syntactic predicates in tree grammars are
common--or rather, most large grammars seem to have
one and sometimes two--just because getting to k=1 was
not easy.  v3 should do better.

Outputting a full tree is not a mistake--unless you
are building tree grammars by hand.  Tree grammars
should be built automatically--they are determined by
the annotated input (parser or tree walker)
grammar--and then refactored.  I have also found that
skipping over branches is much less attractive with
automatic tree grammar generation.

--Loring


--- Robert Hill <rob.hill at blueyonder.co.uk> wrote:

> Thought so, I think I made a *huge* mistake when I
> first embarked on this
> task, and that was that my first pass on the input,
> also spits out a tree
> for the WHOLE grammar, which I then use on
> subsequent passes. Now I've been
> though the wringer, there's a whole bunch of stuff
> I'd do differently. - wow
> that feeling of 20/20 hindsight ;)
> I now have loads of cases where I'd like to skip
> branches (like to remove
> declarations of unused variables or events etc) but
> its too late, and the
> whole thing is just a bit too close to the deadline
> I have, to change it all
> round :(
> 
> One thing I have found though, even though it was a
> huge mistake to output a
> tree so early, 95% of all my problems would be
> solved with the ability to
> prune branches as I go.
> 
> Still, its been a great learning exercise, and I've
> learnt so much! I don't
> think I'll be making those mistakes again.
> 
> I'd like to see a full tutorial that shows how to
> avoid some of the pitfalls
> and why you'd want to proceed in a certain
> way,(hopefully your book will
> contain some stuff for Antlr Dummies.. - hey there's
> a book title in there
> somewhere LOL ;)
> maybe if I get time I'll put a simple one together
> for the wiki, a "how not
> to do it" article :) , as I said, its been an
> amazing learning experience,
> and your help as well as those active on the list
> has been totally
> invaluable.
> 
> Thanks guys!
> 
> Rob
> 
> 
> 
> > -----Original Message-----
> > From: antlr-interest-bounces at antlr.org
> [mailto:antlr-interest-
> > bounces at antlr.org] On Behalf Of Terence Parr
> > Sent: 06 November 2006 17:14
> > To: ANTLR Interest
> > Subject: Re: [antlr-interest] Predicate
> Question...
> > 
> > 
> > On Nov 6, 2006, at 2:40 AM, Hill, Robert wrote:
> > 
> > > Does it make sense to have predicates in tree
> parsers in V3?
> > 
> > Possible, but trees should be designed so they are
> unnecessary.  The
> > tree grammar should be trivial...no need for
> preds.
> > Ter
> > > If the predicate is skipped, the
> failedPredException is thrown, and
> > > the parsing following the exception gets out of
> sync.
> > >
> > > Does the rule you're skipping have to be a root
> token?
> > >
> > > I think I'm misunderstanding the usage here.
> > > Does anyone have any pointers to any (simple!)
> examples ?
> > >
> > > Cheers!
> > >
> > > Rob
> > >
> > > Robert Hill
> > > Information Engineer
> > > E       UKIMEA DWP ACU, Hallamshire Business
> Park, 100 Napier St,
> > > Sheffield. S11 8HD
> > > email:  rhill03 at eds.com
> > > Office: +44 114 291 1928
> > > Mobile: +44 7903 185 516
> > >
> > >
> 
> 
> 
> 




 
____________________________________________________________________________________
Sponsored Link

Get a free Motorola Razr! Today Only! 
Choose Cingular, Sprint, Verizon, Alltel, or T-Mobile. 
http://www.letstalk.com/inlink.htm?to=592913


More information about the antlr-interest mailing list