[antlr-interest] How do I compile a generated lexer?

Andrés Mejía andmej at gmail.com
Thu Mar 6 08:25:16 PST 2008


Hello,
I'm totally new to AntLR.
I created a simple grammar for a lexer in ANTLRWorks and generated it via
the "Generate" menu. However, when I'm going to compile the generated Java
code I get an error.

I'm compiling it using "javac mygrammarLexer.java". I'm running Ubuntu
7.10and installed ANTLR via apt-get, the package manager of Ubuntu.

This is the error I get when I try to compile:

$ javac locoTokensLexer.java
> locoTokensLexer.java:3: package org.antlr.runtime does not exist
> import org.antlr.runtime.*;
> ^
> locoTokensLexer.java:8: cannot find symbol
> symbol: class Lexer
> public class locoTokensLexer extends Lexer {
>                                      ^
>

Then I get a lot of other errors.

I've tried compiling using "javac -classpath X mygrammarLexer.java" where X
has taken different values: The path to where antlrworks-1.1.7.jar is, the
path to where antlr.jar is (/usr/share/java on my system) and some other
things...

I'd appreciate your help, because online documentation of AntLR seems to be
disorganized and hard to navigate.

Thanks in advance!
-- 
Andrés Mejía
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080306/025ac12c/attachment.html 


More information about the antlr-interest mailing list