[antlr-interest] heterogeneous AST

Benjamin Niemann pink at odahoda.de
Tue Oct 2 13:34:48 PDT 2007


Hi,

Abhijit Nandkumar Ghonge wrote:
>             Can we implement heterogeneous ASTs in antlr v3? I have
>             downloaded the latest antlr-3.0.1.tar.gz from antlr site and
>             tried out writing a sample code with heterogeneous AST
>             specified as below:
> 
> Exitstatement:
>             'exit'<AST=com.example.core.ExitNode> NEWLINE!
>             ;
> 
> However I'm getting the following error:
> error(100): Expr.g:114:17: syntax error: antlr: FinScr.g:114:17:
> unexpected token: < error(100): Expr.g:114:52: syntax error: antlr:
> FinScr.g:114:52: unexpected token: ExitNode error(106): Expr.g:114:22:
> reference to undefined rule: com error(106): Expr.g:114:26: reference to
> undefined rule: example error(106): FinScr.g:114:32: reference to
> undefined rule: core
> 
> Can anybody help please, since I have done this in antlr-2.7.6, but I'm
> not able implement likewise in antlr-3.0.1?

It'll be in V3.1, syntax is slightly different, just "TOKEN<class>". You can
download the latest snapshot from fisheye
<http://fisheye2.cenqua.com/browse/antlr> and compile it yourself, if you
are brave enough. Don't know what the ETA is for the 3.1 release....

HTH



More information about the antlr-interest mailing list