On Sun, Dec 5, 2010 at 11:21 AM, Chao Wang <chaowan...@gmail.com> wrote:

> here is the stack trace:
>
> localhost:output mac$ javac TLexer.java  TParser.java  Test.java
> Test.java:8: cannot find symbol
> symbol  : constructor ANTLRFileStream(java.io.InputStream)
> location: class org.antlr.runtime.ANTLRFileStream
>         TLexer lex = new TLexer(new ANTLRFileStream(System.in));
>                                 ^
> Test.java:11: cannot find symbol
> symbol  : constructor
> TParser(org.antlr.runtime.CommonTokenStream,int,<nulltype>)
> location: class TParser
>         TParser g = new TParser(tokens, 49100, null);
>                     ^
> 2 errors
>
>
The compiler can't find the .class file for the ANTLR runtime. Try:

$ java -cp antlr-3.2.jar org.antlr.Tool T.g
$ javac -cp antlr-3.2.jar *.java
$ java -cp .:antlr-3.2.jar Main


instead.

I tested it with ANTLR 3.2 (the site is down so couldn't download 3.3) with
the following class:

import org.antlr.runtime.*;

public class Main {
    public static void main(String[] args) throws Exception {
        ANTLRStringStream in = new ANTLRStringStream("call f;");
        TLexer lexer = new TLexer(in);
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        TParser parser = new TParser(tokens);
        parser.r();
    }
}


Bart.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to