[antlr-interest] request for comments on language implementation

Michael Bedward michael.bedward at gmail.com
Wed Feb 25 14:54:47 PST 2009


Hi folks,

Nice discussion - I'm finding it most interesting and helpful.

Andy: many thanks for your specific comments on Jiffle.  That's just
the kind of feedback that I was hoping for.

Regarding "how to" info: I'm in the process of adding demo code and
updating the wiki pages to help people try it out.  I hadn't thought
about providing an ant script for non-maven users but that's a great
idea.  Also, there will be binaries to download later on.

Regarding grammar imports: I was put off trying that first up after
someone commented that it wasn't working properly in ANTLR3.1.1 (a
post in the recent thread on cascading AST rewrites).

OK, regarding my experience with tree rewrites...  Andy is correct in
that it was fun for me because I was learning along the way.  My
(ill-defined) approach probably falls somewhere between Andy's
preference for manual coding and Andreas and Ter's preference for
rewrite grammars...  Once I have the preliminary AST from the token
parser and submit it to a tree walker (VarClassifier) to categorize
variables, track dependencies etc.  VarClassifier.g contains a lot
more Java than ANTLR statements.  The grammars for subsequent tree
rewriting are mostly ANTLR content.  For these I found it easiest to
break the process into a number of very simple transformation stages
so the grammars for each were straightforward.  (Andy, morph2.g and
morph3.g became redundant after a few coding iterations - I'll do some
file renaming when it all setlles a bit more so people don't worry
about missing files).

There are two things I worry about with the Jiffle code as it stands...

1. Andy's point about how easy it will be for anyone else to pick up
the tree rewriting stuff.  Of course this can be helped a lot by
documenting properly now and I'm trying to be virtuous in this regard.

2. Possible 'fragility' of a cascade of rewrites.  Yes, it works now
but have I unwittingly built a house of cards with these multiple
grammars ?  I plan to extend the language but each changed or new
feature has to be propagated up through the stack of grammars.  It
will be interesting to see how this goes.

Ter: I've looked longingly at your wiki page on tree pattern matching
:-)  This would be enormously useful for Jiffle.

Finally, I don't want to put a damper on this general discussion but
I'd also be really grateful for further specific feedback on Jiffle.

cheers
Michael


More information about the antlr-interest mailing list