javacc-3.2.tar.gz (you need gunzip and tar utilities to unpack)
or
javacc-3.2.zip (you need unzip or equivalent utilityto unpack)
gunzip -c javacc-3.2.tar.gz | tar ovxf -
unzip javacc-3.2.zip
This should create the subdirectory tree:
javacc-3.2 bin ... doc CharStream.html JJDoc.html JJTree.html apiroutines.html commandline.html docindex.html errorrecovery.html features.html getstarted.html index.html installhelp.html javaccgrm.html javaccreleasenotes.html simpleREADME.html ... examples JJTreeExamples SimpleExamples ...
The bin directory contains the javacc and jjtree tools.
Modify your PATH environment variable:
Add to your PATH environment variable either .../javacc-3.2/bin (Unix) or ...\javacc-3.2\bin (Windows) where ... should be replaced by the path to the directory where you unpacked the compressed javacc-3.2 file. For example, Unix: If javacc-3.2 was unpacked in directory /users/mylogin, add this directory to your PATH environment variable /users/mylogin/javacc-3.2/bin or Windows: If javacc-3.2 was unpacked in directory c:\Program Files, add this directory to your PATH environment variable c:\Program Files\javacc-3.2\bin
See installhelp.html in the javacc-3.2/doc directory
Download ex1.jjt and ex2.zip from class Homework web page.
At a command prompt $ a. $ jjtree ex1.jjt Generates - some .java files; These are used by the parser to build an Abstract Syntax Tree. - ex1.jj; This file is a description of a parser. You will run javacc on this file. b. $ javacc ex1.jj Generates the .java files for the parser itself including ex1.java c. $ javac *.java Compile all the .java files including ex1.java d. $ java ex1 Run the ex1 java application
First unzip ex2.zip to unpack the files:
ASTAdd.java ASTId.java ASTInteger.java ASTMult.java ASTStart.java ex2.jjt JJTex2State.java PostFixVisitor.java
Then follow the same steps above replacing ex1 by ex2.
(javacc examples) javacc-3.2/examples/SimpleExamples These are examples with .jj files only You skip step 1 of running jjtree and begin at step 2. E.g. $ javacc Simple1.jj (jjtree examples) javacc-3.2/examples/JJTreeExamples This directory contains several .jjt files. Do all steps above beginning at step 1. E.g. $ jjtree eg1.jjt