ANTLR 2.7.2 Installation ANTLR comes as a single zip or compressed tar file. Unzipping the file you receive will produce a directory called antlr-2.7.2 with subdirectories antlr, doc, examples, and lib. You will find antlr.jar (<400k), which contains all the runtime necessary to use ANTLR-generated Java-based recognizers but also the ANTLR tool itself. You need to place the antlr-2.7.2/antlr.jar jar in your CLASSPATH environment variable so the ANTLR .class files can be seen. For example, if you placed antlr-2.7.2 in directory /tools, you need to append
to your CLASSPATH or.
if you work on a Windows box. References to antlr.* will map to /tools/antlr-2.7.2/antlr/*.class. You must have at least JDK 1.1 installed properly on your machine. The ASTFrame AST viewer uses Swing 1.1 package names now.
ANTLR is a command line tool (although many development environments let you run ANTLR on grammar files from within the environment). The main method within antlr.Tool is the ANTLR entry point.
If you have trouble running ANTLR, ensure that you have Java installed correctly and then ensure that you have the appropriate CLASSPATH set. See Getting started.
If you alter ANTLR itself (i.e., it's Java files) and you want to rebuild ANTLR itself, make sure that the Java files in the antlr/build directory are compiled (just jump in and say "javac *.java"). Then, from the antlr-2.7.2 directory you can run the portable antlr self-build: java antlr.build.Tool buildTo make the jar file java antlr.build.Tool jarThis uses property antlr.build.root to figure out where the antlr dir associated with the antlr package resides. It defaults to "." (current directory). You may also set the compiler as in: java -Dantlr.build.compiler=jikes antlr.build.Tool buildI have tested this on win2k (cmd shell and bash from GNU) and Mac OS X. Further, I have removed all of the build shell scripts and mkjar type scripts I had since there is only one all encompassing antlr.jar now and a self-build tool. See the associated doc files for building C++ or building C# support files. |