[antlr-interest] anybody get bitten by ANTLR's AST interface requirement

O.E. Dragon dragonoe at mcmaster.ca
Thu Jan 19 11:06:05 PST 2006


On Thu, 19 Jan 2006 10:53:51 -0500
 Andy Tripp <antlr at jazillian.com> wrote:
> Also, I'd get rid of all the antlr.collections stuff and ASTIterator
> and ASTPair and use
> use the standard collections and generics.

I don't know for sure but wouldn't that cause a backwards compatibility
problem if people need to use a Java 1.4 compiler. Otherwise I
completely agree.

In particular there's a number of things that would be much easier for
me if TokenTypes was an enum type instead of an int. I don't suppose it
would be too difficult to have ANTLR v3 output both Java 1.4 and Java
1.5, seeing as the new ST-based translation back-end appears to be very
flexible.

I'd be up to the task of writing the ST templates for Java 1.5 if
Terence's plan was to only do 1.4. But then the problem of having the
ANTLR library using 1.4 or 1.5 could become an issue.

I think it might be worth it to seperate ANTLR the compiler compiler
from outside utilities like ASTIterator, etc. Let the ANTLR tool
standalone and be used only to translate grammars, written in one
language (Java). And make an external library coded in various
different languages (possibly all the target languages) and contain
various augmenting utilities that can be used by the user.

About the AST interface, I wouldn't say I got "bitten hard" by it, but
I started using it and quickly noticed it was too restrictive. I
basically ended up subclassing CommonAST and use that subclass
everywhere because there were a lot of added methods that weren't part
of the interface, which I couldn't access by declaring variables as
AST.

-Olivier


More information about the antlr-interest mailing list