How to run SableCC

There are two versions of SableCC that you can use.
  • SableCC version 2.18.2, is very stable, but does not include the automatic CST-to-AST transformations that SABLECC 3 supports.
  • SableCC version 3-beta.3, should also be quite stable, and it does offer the very nice features of providing a nice way of producing an AST. There is limited documentation on this version, but it is not hard to use, and several examples are provided below.
  • Both versions are installed on the SOCS teaching network. Note that tar.gz files are also provided for both versions if you wish to install them on your own machines. Note that to do a full install you will need to use ant . If you just want to run SableCC then you really only need the sablecc.jar file which can be found in the lib/ subdirectory for each version.

    On a teaching network machine you can examine the directory ~hendren/SableCC/ , from the web you can visit it via this symbolic link. .

You can run SableCC on a teaching machine as follows:
  • setting the SABLECCDIR
    setenv SABLECCDIR ~hendren/SableCC/sablecc-2.18.2
    or setenv SABLECCDIR ~hendren/SableCC/sablecc-3-beta.3
    depending on which version of SableCC you would like to use.
  • and then compile a sablecc specification file, foo.sablecc , as follows:
    java -jar $SABLECCDIR/lib/sablecc.jar foo.sablecc Of course, you may define your own alias or script to make this command more convenient. A sample makefile is also available in the first example below.

Examples of using SableCC version 2 are found in:

Examples of using SableCC version 3 are found in: