[antlr-interest] Predicate Question...

Robert Hill rob.hill at blueyonder.co.uk
Mon Nov 6 12:46:08 PST 2006


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
> >
> >





More information about the antlr-interest mailing list