[antlr-interest] Antlr 3.0: run time and java compiling errors

Martin Probst mail at martin-probst.com
Thu Jul 13 06:14:32 PDT 2006


Hi,

> C:\antlrworks\mio_codice\fatto>java JavaParser < JavaParser.java
> Exception in thread "main" java.lang.NoClassDefFoundError: JavaParser
>
> C:\antlrworks\mio_codice\fatto>java JavaParser
> Exception in thread "main" java.lang.NoClassDefFoundError: JavaParser

Did you compile the class? Is your classpath set up correctly?

> C:\antlrworks\mio_codice\test>javac JavaParser.java
> JavaParser.java:42: <identifier> expected
>     public void class() throws RecognitionException {
>                 ^
> JavaParser.java:42: <identifier> expected
>     public void class() throws RecognitionException {
>                      ^

This seems to be an actual problem of the grammar. It probably has a  
rule called "class", which is illegal in Java as "class" is a  
keyword. Simply rename the rule in the .g file.

> JavaParser.java:2704: '{' expected
>     public static final BitSet FOLLOW_AccessSpecifier_in_class36 = new
> BitSet(ne
> w long[]{0x0000000000040000L});
>
>                               ^
> JavaParser.java:2866: '}' expected
> }
>  ^
> 4 errors

No idea about this one, maybe something coming from the context in  
that file?

Martin


More information about the antlr-interest mailing list