[antlr-interest] Anyone built the example C grammar successfully?

Loring Craymer Loring.G.Craymer at jpl.nasa.gov
Tue May 24 13:10:23 PDT 2005


Paul--

Try deleting the "import CToken;" line and see what that does.  As I read 
the spec, "CToken" is not a "canonical name"--I think that it needs package 
qualifiers for that.

--Loring


At 10:56 AM 5/24/2005, Paul Johnson wrote:
>John D. Mitchell wrote:
>>>>>>>"Paul" == Paul Johnson <gt54-antlr at cyconix.com> writes:
>>>
>>>Has anyone managed to build John Mitchell's/Monty Zukowski's C grammar
>>>(http://www.antlr.org/grammar/cgram)? I've tried this on gcj 3.3, gcj
>>>3.4.3, and javac 1.5.0_03, and none of them can compile more than a few
>>>files. I don't know any Java, which doesn't help, but it looks it may be
>>>like an import or compilation order problem:
>>I've been working with it using Java v1.4.x recently without problem.
>>But, I haven't tried it with either Java v1.5.x or GCJ.
>>
>>>./TNode.java:9: '.' expected import CToken; ^
>>
>>Hmm... Is that a clash with the new "static" imports in Java v1.5?
>
>Don't think so - I found a backwards-compatibility flag for javac, and 
>it's not making any difference:
>
> > javac -source 1.4 -classpath .:/eda/antlr/antlr-2.7.5/lib/antlr.jar 
> StdCParser.java
>
>   ./TNode.java:9: '.' expected
>   import CToken;
>                ^
>
>The error message produced by gcj is different - it complains about an 
>ambiguous class definition (see 
><http://www.antlr.org/pipermail/antlr-interest/2005-May/012212.html>, 
>also related to CToken). The fact that both gcj and javac point to the 
>same import does seem to imply a problem with the code, at least to 
>someone who knows as little Java as I do.
>
>Thanks -
>
>Paul




More information about the antlr-interest mailing list