AST f actory / heterogeneous tree enhancement

Terence Parr parrt at jguru.com
Mon Oct 21 15:58:42 PDT 2002


On Monday, October 21, 2002, at 03:00  PM, ngormley1974 wrote:

> Ter,
>
> Great, I'll get to test this as soon as you can get it done......
>
>>      but we need to instead generate:
>>
>>      AST v = (AST)astFactory.create(LT(1),"INTNode");
>>
>
> Just one comment: Could it call the factory creation with the class
> of node e.g.
>
> AST v = (AST)astFactory.create(LT(1),INTNode.class )
>
> instead, so we get compile time checking.

THis won't buy you compile time checking unfortunately...you are 
passing in a Class object to that method each time regardless of node 
type. :(

Terence
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Lecturer in Comp. Sci., University of San Francisco



More information about the antlr-interest mailing list