The Tool Reference Compiler
The latest version is 1.9. You can obtain it from here.
You can run it as follows:
java -jar toolc-reference-1.9.jar program.tool
toolc just compiles a Tool program to bytecode like your implementation will. You can however also use the reference implementation for other things. Try to run
java -jar toolc-reference-?.?.jar --help
for a list of available options. You can for instance print out some intermediate representations. Later in the project you will also be able to use the reference implementation to check that the operations you perform on the abstract syntax trees are valid.
The current options are:
--help display this message --version display the version number --tokens show tokens of input program --trees show trees of input program --pretty show pretty-printed source of input program --symbols show pretty-printed source with unique symbol IDs --lint checks the validity of the program without generating classes --main prints the name of the main object to stdout --check-symbols parse the program annotated with unique symbol IDs
We welcome bug reports! Please use the forum on Moodle for this purpose.
2011-12-07 1.9 Fixed bug in string encoding during code generation (cafebabe bug). 2011-11-30 1.8 Fixed bug for Windows, where file.separator is \. (Thanks to J. Menétrey) 2011-11-17 1.7 toolc now stores positional information in bytecode. It also stores the name of the source file. Classes cannot be named 'Object'. Same restriction applies to main object. (Thanks to A. Fiaux) 2011-11-10 1.6 Uses stderr for all warnings and errors. Fixed incompatibility between --check-symbols and -d. 2011-10-14 1.5 Added --version option. 2011-09-27 1.4 Compiled with Scala 2.9.1. First release for 2011 course. 2011-04-02 1.3 Added --nyan option. 2010-10-21 1.2 Fixed the positioning of DIV tokens. More information is provided with --tokens. 2010-10-07 1.1 Fixed a bug with in the lexical analyzer with large integer literals. (Thanks to S. Vasey for pointing this out). 2010-09-28 1.0 First release.