[antlr-interest] On trees and JavaBeans, part 2: tree creation

Micheal J open.zone at virgin.net
Wed Apr 20 02:35:10 PDT 2005


Bryan,

> I can't give examples, because I don't know what half the words mean. 
> What is "beans" in java?  What /exactly/ is an interface, and 
> how is it supported in other languages?  If this is a "for 
> java we're gonna ..." discusion, then I guess it doesn't 
> matter since I'm aiming at C++ and eventually C.

Whilst Scott's posts included references to beans, I've only been interested
in the idea of introducing an abstract model of a tree to support the use of
custom tree representations. We use a similar model with a customized ANTLR
2.x for C# and C++.

For C++, an interface is synonymous with an abstract base class that has
only pure virtual functions (just like the existing AST "interface" in
AST.hpp). In C, it may be a struct that has only function pointer members.

> The is to make sure we don't bind ANTLR to java unintentionally. 
> There are other targets, and we need to make sure the overall 
> design is sound before spinning off into implementation and 
> target language details.

It seems this change might be doable at the codegen level only - i.e. by
supplying an alternative codegen template. However, it would be *much*
better if were supported by default in the standard ANTLR package for
supported languages.

I can't honestly thing of a language that would have problems with the extra
level of abstraction this proposal entails.

Cheers,

Micheal



More information about the antlr-interest mailing list