[antlr-interest] Can't create AST Node?

Tiller, Michael (M.M.) mtiller at ford.com
Thu Jul 8 10:35:04 PDT 2004



> -----Original Message-----
> From: Ric Klaren [mailto:klaren at cs.utwente.nl]
> Subject: Re: [antlr-interest] Can't create AST Node?
> 
> On Thu, Jul 08, 2004 at 10:54:09AM -0400, Tiller, Michael (M.M.)
wrote:
> > Actually, I've reached the end of the rope with heterogenous AST
types
> > in ANTLR.  It was such a pain to do this in C++ and I see a whole
new
> > horizon of problems on the Java side.  I'm just going to bite the
bullet
> > and turn "buildAST" off and make the tree myself.  It is just too
much
> > trouble (for me) to deal with all the inheritance and casting
issues.
> > The downside is that this tosses tree parsing right out the window
but I
> > haven't really used the tree parser stuff anyway so I'm not losing
much
> > there.
> 
> I can understand. The heterogeneous AST stuff always looked like a
quick
> hack on top of the old functionality. The combination of the action
parser
> and the codegenerators is really sucky when it comes to figuring the
stuff
> out for codegeneration.
> 
> Actually you can come a very long way with just using a custom AST.
(which
> is what I'm doing in my projects so far) Once you got a homogeneous
AST
> you can quite easily convert it to a custom structure that better
support
> visitor like patterns and such.

Well that is what I was attempting in the original note in this message
but I couldn't get that to work either!

> I hope we can get the heterogeneous stuff right in ANTLR 3. (Or if
someone
> gets inspiration to lobotomize the current ANTLR 2 codegen interface)

Well, once I get ANTLR to build my tree the way I want it, I'll try to
put something together to show what I did how I would like things.
Obviously, if my needs are unique then I don't expect much support for
them from ANTLR.  So far, I find the grammar much easier to follow than
before with the added benefit that I'm not casting stuff all over the
place or introducing lots of complexity to support tree parsing.

> It might be though that the problem on the java side is easier. The
> absence of the Reference counter's in java might make things a lot
> less painfull as things are on the C++ side.

Keep in mind that I'm doing this in **Java**.

> Cheers,
> 
> Ric



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list