MAGELANG! |
ANTLR 2.6.0 Installation ANTLR comes as a single zip or compressed tar file. Unzipping the file you receive will produce a directory called antlr-2.6.0 with subdirectories antlr, doc, examples, cpp, and examples.cpp. You need to place the antlr-2.6.0 directory in your CLASSPATH environment variable. For example, if you placed antlr-2.6.0 in directory /tools, you need to append
to your CLASSPATH or.
if you work on an NT or Win95 box. References to antlr.* will map to /tools/antlr-2.6.0/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. ParseView Debugger The ParseView debugger by Scott Stanchfield must be downloaded separately if you want to use the "-debug" option of ANTLR. Click here to download the debugger. Then unzip it over the antlr-2.6.0 directory (the zip contains antlr.debugger.* etc...). JAR FILE Try using the runtime library antlr.jar file. Place it in your CLASSPATH instead of the antlr-2.6.0 directory. The jar includes all parse-time files needed (if it is missing a file, email parrt@jguru.com). You can make antlr.debug.jar (has antlr.jar stuff pluse the debug classes needed by parseview) by running mkdebugjar. You cannot run the antlr tool itself with the jar, but your parsers should run with just this jar file. It's pretty small, around 50k uncompressed.
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.
The command-line option is -diagnostic, which generates a text file for each output parser class that describes the lookahead sets. Note that there are number of options that you can specify at the grammar class and rule level. Options -trace, -traceParser, -traceTreeParser may be used to track the lexer, parser, and tree parser invocations. Run the tool without any arguments to see the complete option list for the comamnd line. Try the new -html option to generate HTML output of your grammar(s). Not completed, of course... :( If you have trouble running ANTLR, ensure that you have Java installed correctly and then ensure that you have the appropriate CLASSPATH set. |