[antlr-interest] Python - rookie questions

Benjamin Niemann pink at odahoda.de
Sun Jun 15 10:16:41 PDT 2008


Hi Sandra,

On Sun, Jun 15, 2008 at 6:27 PM, Sandra Turner <slt60 at hotmail.com> wrote:
> I'm trying to create a Python lexer and parser on an Ubuntu 8.04
> system.  I've downloaded ANTLR 3.1b1, gone into the
> antlr-3.1b1/runtime/Python directory and typed "python setup.py
> install" per http://www.antlr.org/wiki/display/ANTLR3/Python+runtime
> .  How do I run antlr?  I looked at the following, but when I do a
> locate "org.antlr.Tools", nothing shows up
> http://www.antlr.org/wiki/pages/viewpage.action?pageId=729.

You have to point your CLASSPATH to the .jar files in the lib folder:
export CLASSPATH=/path/to/lib/antlr-3.1b1.jar:/path/to/lib/antlr-2.7.7.jar:/path/to/lib/stringtemplate-3.1.jar
Then you can invoke antlr using:
java org.antlr.Tool grammar.g

You may want to wrap this up into a little shell script for ease of use.

> I've also downloaded ANTLRWorks Version 1.1.7 an untarred the file.  What do
> I do to display the GUI?

Mm.. ANTLRWorks comes as a .jar file, you don't have to extract this.
Just invoke with:
java -jar antlrworks-1.1.7.jar

> I've
> also download ANTLRWorks Version 1.1.7 on a Windows XP system and run
> the SimpleCalc example from
> http://www.antlr.org/wiki/display/ANTLR3/Five+minute+introduction+to+ANTLR+3.
>
> I was able to select Generate->Generate Code, but when I selected
> Debugger->Debug, I got the error "Error while generating the
> grammar: (10): internal error: no such group file Dbg.stg."  Any
> advice?

The Python target does not yet support debugging from ANTLRWorks, sorry.


HTH

-Ben


More information about the antlr-interest mailing list