[antlr-interest] ANTLR3 first try

Johannes Luber jaluber at gmx.de
Sun May 27 08:33:49 PDT 2007


Fabio Maulo wrote:
> I had download ANTLR3.
> -Install dir is C:\antlr\antlr-3.0
> -Set the classpath and verify it
>    C:\>echo %classpath%
>    C:\antlr\antlr-3.0\lib
> -Jars in classpath are: antlr-2.7.7.jar, antlr-3.0.jar,
> antlr-runtime-3.0.jar, stringtemplate-3.0.jar
> 
> When i try to generate something the message is
> C:\>java org.antlr.Tool Calculator.g
> Exception in thread "main" java.lang.NoClassDefFoundError: org/antlr/Tool
> 
> Which is my mistake ?

You can't use "C:\antlr\antlr-3.0\lib" as a classpath. List each of
those jars explicitly like "C:\antlr\antlr-3.0\lib\antlr-2.7.7.jar".

> Another little thing:
> In AntlrWorks page there is
> "ANTLRWorks supports code generation in any language that ANTLR knows
> how to generate via the output=/language/ option"
> 
> Where I can set that option to generate CSharp code ?
Use

options {language=CSharp;}

Inside the grammar file. BTW, the order in which such extra commands are
listed is still important (Terence wants to change that in a future
version). If you get an exception at a seemingly valid command, try to
change the order.

Best regards,
Johannes Luber


More information about the antlr-interest mailing list