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

Bertalan Fodor (LilyPondTool) lilypondtool at organum.hu
Thu Mar 6 08:35:46 PST 2008


Note that to fully use Antlr you should have a solid knowledge of Java. 
The jar file itself must be in the classpath, not the path of the jar.

Bert


Andrés Mejía wrote:
> 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.10 and 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


-- 
LilyPondTool is the editor for LilyPond files.
See http://lilypondtool.organum.hu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080306/1b1d0b85/attachment.html 


More information about the antlr-interest mailing list