[antlr-interest] Re: Making the C grammar in cgram.tgz

edcjones edcjones at yahoo.com
Sun Mar 9 19:01:43 PST 2003

I have now discovered what the problem is.

1. It is better to use full path names in a CLASSPATH. My
".bash_profile" now says:

     export CLASSPATH

2. In the .java files in cgram/grammars, comment out "import CToken;"
and "import LineObject;". One cannot shorten a one-token name.

Here is how this Python user and Java / antlr newbie got confused:
"import" means different things in Java and Python. In Python, "import
sys" makes the contents of module "sys" available for use. In Java,
"import antlr.SemanticException;" allows the use of the name
"SemanticException" instead of "antlr.SemanticException".

--- In antlr-interest at yahoogroups.com, mzukowski at y... wrote:
> This doesn't make sense to me.  It's like it's confused between
having both
> . and ../grammars be the same directory.  Did you try it without
> in your classpath?
> Sorry for the late reply, I was in the middle of the Pacific as of
> just starting to slog through the hundreds of antlr messages I
> Monty

> --- In antlr-interest at yahoogroups.com, "edcjones <edcjones at y...>"
> <edcjones at y...> wrote:
> > I have installed Blackdown Java Version 1.4.1-beta (based on Sun's
> > 1.4.1-pre-rc-b17) and antlr-2.7.2 on my Gentoo Linux PC.
> > 
> > In the antlr resources, there is a grammar for C in a file
> > "cgram.tgz". I have set the classpath to
> > 
> >     /usr/local/src/antlr-2.7.2:../grammars:../examples:.
> > 
> > I am having trouble getting cgram to compile. I cd to "grammars"
> > do "make". I get the error message:
> > 
> >     javac StdCParser.java
> >     ../grammars/TNode.java:9: '.' expected
> >     import CToken;
> >              ^
> >     1 error
> >     make: *** [StdCParser.class] Error 1


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list