[antlr-interest] Problem building 'cgram' example

Paul Johnson gt54-antlr at cyconix.com
Wed May 18 08:21:35 PDT 2005


I'm having a problem building the C grammar in the distribution (with 
gcj, so I guess this may not have been tested). Unfortunately, I don't 
know any Java, so I have no idea what's causing the problem.. :)

Any input appreciated. StdCParser.g includes the line:

       { import CToken; ... }

This gets copied to the generated Java output files as:

----
import antlr.Token;
...
    import CToken; // line 27
----

When I compile the generated files I get an ambiguous class error:

----
gcj --classpath .:/eda/antlr/antlr-2.7.5/lib/antlr.jar -C StdCLexer.java
StdCLexer.java:27: error: Ambiguous class: `CToken' and `antlr.Token'.
    import CToken;
           ^
----

CToken is part of the example code, and is basically just:

----
import antlr.CommonToken;
public class CToken extends antlr.CommonToken {...}
----

Any ideas?

Thanks -

Paul



More information about the antlr-interest mailing list