[antlr-interest] can ANTLR tool itself use 1.5?

Miguel Ping mblp at mega.ist.utl.pt
Mon Apr 2 13:51:02 PDT 2007


My .2€ is "go for it".I guess the 1.5 vm should have some neat
improvements over 1.4, like reduced memory footprint, faster runtime
and faster startup.
BTW, is it hard to change the java template to take use generics? Or
one must rewrite some antlr internal stuff? I think generics could be
useful in some exposed parts of antlr, like in tree nodes for
instance. I have this:

public class SQLTreeAdaptor extends CommonTreeAdaptor {
	public Object create(Token payload) {
		return new SQLTree(payload);
	}
}

But I would like this:
public class SQLTreeAdaptor extends CommonTreeAdaptor<SQLTree> {
	public SQLTreecreate(Token payload) {
		return new SQLTree(payload);
	}
}

where CommonTree adaptor is a class<T extends CommonTree>.
and with some work I would get rid of this cast:

grammar.setTreeAdaptor(new SQLTreeAdaptor());
SQLParser.startRule_return retTree = grammar.startRule();
SQLTree tree = (SQLTree) retTree.getTree(); //dummy cast

Tks in advance,
Miguel Ping

On 4/2/07, Terence Parr <parrt at cs.usfca.edu> wrote:
> Hi,
>
> I'm thinking of using generics for ANTLR internals.  The generated
> code will be 1.4 compatible, but the version number will be wrong for
> VM.  So, probably still 1.5 would be required to run antlr.  Do I
> need to keep 1.4 compatible or is it ok to go to 1.5 nowadays do you
> think?
>
> For now, i can keep the runtime 1.4 compatible, however.
>
> Thanks,
> Ter
>


More information about the antlr-interest mailing list