[antlr-interest] Ultimately Frustrated

Raymond J. Schneider rschneid at bridgewater.edu
Fri Feb 13 20:10:28 PST 2009


I'm really frustrated with what must be a trivial problem but I seem to be chasing my tail.
To try to isolate things I put the antlrworks-1.2.2.jar file in a folder with Expr.g
I ran:> java -cp antlrworks-1.2.2.jar org.antlr.Tool Expr.g 
That generated ExprLexer.java, ExprParser.java, and Expr.tokens
So I added to the directory the Test Harness Test.java with the code:

---
import org.antlr.runtime.*;

public class Test {
    public static void main(String[] args) throws Exception {
        ANTLRInputStream input = new ANTLRInputStream(System.in);
        ExprLexer lexer = new ExprLexer(input);
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        ExprParser parser = new ExprParser(tokens);
        parser.prog();
    }
}
---
Then I tried to compile it with:
>javac -cp antlrworks-1.2.2.jar Test.java ExprLexer.java ExprParser.java

All the documentation seems to indicate this should work but what I get is:
I:\E>javac -classpath antlrworks-1.2.2.jar Test.java ExprLexer.java ExprParser.java
Test.java:6: cannot find symbol
symbol  : class ExprLexer
location: class Test
        ExprLexer lexer = new ExprLexer(input);
        ^
Test.java:6: cannot find symbol
symbol  : class ExprLexer
location: class Test
        ExprLexer lexer = new ExprLexer(input);
                              ^
Test.java:8: cannot find symbol
symbol  : class ExprParser
location: class Test
        ExprParser parser = new ExprParser(tokens);
        ^
Test.java:8: cannot find symbol
symbol  : class ExprParser
location: class Test
        ExprParser parser = new ExprParser(tokens);
                                ^
Note: ExprParser.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors

All the .java files are in the same directory
Probably some old hand can look at this as identify my error, but I certainly can't seem to.
I'd appreciate any help.
I can run Expr.g in ANTLRWorks directly but not from the command line.

Regards, Ray
--
Ray Schneider,PE, Ph.D
Associate Professor
Math and Computer Science
Bridgewater College
http://www.bridgewater.edu/~rschneid/
http://theweedlessgarden.blogspot.com
 


More information about the antlr-interest mailing list