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

Terence Parr parrt at cs.usfca.edu
Thu Jan 19 12:15:37 PST 2006


On Jan 19, 2006, at 11:06 AM, O.E. Dragon wrote:

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

Oh, right.  Yeah, i won't be using generics...don't need 'em.

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

not a problem.  Just a subgroup of the main Java template group.  I'm  
using this very example in my ST paper.

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

Ah.  That is true.

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

Ok, well, seems like Object as the AST type is pretty useful then.   
I'll leave it.

Ter


More information about the antlr-interest mailing list