# [antlr-interest] [v3] Lack of documentation

David Piepgrass qwertie256 at gmail.com
Sun Jul 1 09:22:07 PDT 2007

> Getting started with ANTLR v3 is a frustrating experience for its lack of
> coherent documentation and non-trivial example code.
>
> I've been using ANTLR since the good old times when it used to be called
> PCCTS, and I always used to be fond of it, but I am disappointed with v3.
>
> Marketing-style hype about the latest cool features does not really help
> when you get no little or no information on how to use them.

I know how you feel. I even bought the book and was pretty
disappointed with it. For starters I had no idea that there would be
absolutely no information about non-Java targets, it's hard to use as
a reference because much of it is treated as a tutorial, there is no
tutorial or reference for the runtime library, there's no specific
discussion of differences between v2 and v3, no complete grammar file
in chapter 3 ... I could go on. (mind you, there is a lot of useful
information despite these problems.)

Still, I think it's a general problem in the computer field that the
authors of the most useful projects, i.e. open-source projects, have
trouble getting paid anything for their work. The government, and most
social institutions, have provided no means of making money except
selling copies of something. This is very unfortunate, because
e-copies cost nothing to make and logically should be free, but I
don't think you can blame Ter for it. It's a limitation of our
society's institutions. He could give away the PDF, but I think the
truth is, it would hurt book sales. Don't be mad at Ter just because
there are more generous people out there who give away all their hard
work for little or nothing in return.

Anyway, there is a lot more useful information about ANTLR online now.

Here's a nice collection of notes for writing lexers:
http://wincent.com/knowledge-base/ANTLR_lexers_in_depth

If you're using C#, here are a couple of helpful links:
http://www.codeproject.com/csharp/sota_expression_evaluator.asp
http://www.manuelabadia.com/blog/PermaLink,guid,ff1dc504-f854-40b4-bfe7-250ce91efad7.aspx

And here is some information I wrote earlier about setting up the
classpath for ANTLR 3:
--------------------------------------------------------------------------
Ok, I found the answer at

http://www.antlr.org/wiki/pages/viewpage.action?pageId=728

except that it doesn't say how to add the .jars to the classpath, nor
what Java version is required. IMO, there should be a link to this
page from the download page, and the link to "ANTLR tool+runtime
binary only jar" should have a disclaimer saying that the jar is not
usable by itself.

On windows the CLASSPATH is normally forgotten when you exit a command
prompt so you might find it useful to write a batch file that contains
this:

@echo off
echo Note, you must edit this file to set the path to the JARs!
set antlrpath=C:\Path\to\antlr-3.0\lib
set classpath=%antlrpath%\antlr-2.7.7.jar;%classpath%
set classpath=%antlrpath%\antlr-3.0.jar;%classpath%
set classpath=%antlrpath%\antlr-runtime-3.0.jar;%classpath%
set classpath=%antlrpath%\stringtemplate-3.0.jar;%classpath%
echo Classpath: %classpath%

IMO scripts like this should be included with ANTLR. After you run the
above, commands like

java org.antlr.Tool Test.g

should work.
--
- David
http://qism.blogspot.com


More information about the antlr-interest mailing list