[antlr-interest] How to separate lexer and parser? How to invoke ANTLR?

David Piepgrass qwertie256 at gmail.com
Mon May 28 18:32:49 PDT 2007


I know v3 has combined grammars, but I want a separate lexer and parser.
However, when I try to compile a grammar without a parser, ANTRLWorks says

>  Cannot generate the grammar because
>  (100): D:\...\Test.g:0:0: syntax error: codegen: <AST>:0:0: unexpected
end of subtree

Ideas?

I would also like to manually control the numeric IDs for token types, in
order to share some of the same numbers between multiple lexers; how can I
do this?

Also, how do I invoke antlr-3.0.jar from the command line? The book says to
use

java org.antlr.Tool Test.g

which I changed to

java -classpath antlr-3.0.jar org.antlr.Tool Test.g

but I got the error

>  Exception in thread "main" java.lang.NoClassDefFoundError:
org/antlr/stringtemplate/StringTemplateErrorListener
>        at org.antlr.Tool.main(Tool.java:67)

Forgive me, I'm not a Java guy. How can I make it work?
-- 
- David
http://qism.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070528/f0d91da3/attachment.html 


More information about the antlr-interest mailing list