SableCC Example

The code in this directory illustrates working with SableCC to create a simple expression evaluator (and printer). The elements:

To build, save all the files to a directory, download sablecc-3.7.jar (or later), and type

        java -jar sablecc.jar exp.grammar
        javac Echo.java
        javac Eval.java
The first step creates various subdirectories; these are used to implement Echo and Eval. Once the programs are compiled, you can execute them by typing
        java Echo exp1
        java Eval exp1
<-- The following applies to older versions of SableCC:

Note: the above will result in warnings because SableCC generates code that doesn't use templates. To supress the warnings type

        javac -Xlint:-unchecked Echo.java
        javac -Xlint:-unchecked Eval.java
-->

An alternative build method is to use the makefile:

        make
        make clean

Notes about SableCC

Miscellaneous things I've worked out about SableCC from doing this example: