[antlr-interest] (newbie) Using ANTLRWorks generated classes

Benjamin Niemann pink at odahoda.de
Tue Jul 17 07:05:49 PDT 2007


Hello,

Felipe Carvalho wrote:

>     I'm using ANTLRWorks 1.0.2 to debug statements against a grammar file
>     (.g) and I noticed it creates two Java files, one for the parser and
>     one for the lexer. I'm trying to reuse those generated classes to
>     retrieve the debug output, but when I instantiate the parser, passing
>     in CommonTokenStream and the port to use, the execution flies away and
>     it never comes back.
> 
>     Does anybody know what I'm missing? Aren't these generated classes
>     reusable by external Java code?

These are files generated with the '-debug' option: it has been prepared to
listen on a socket for commands from ANTLRWorks.
To generate parsers for 'normal' use, use 'Generate -> Generate Code' from
the menu, or invoke plain ANTLR on the .g file in your console, e.g.
$ java org.antlr.Tool T.g
(once you have it installed and properly set up the CLASSPATH).

HTH

-- 
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/



More information about the antlr-interest mailing list