The Tool Reference Compiler
The latest version available is 2.7. You can obtain it from here: toolc-reference-2.7.jar.
You can run it as follows:
java -jar toolc-reference-2.7.jar program.tool
Available Options
By default, 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-2.7.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:
Usage: ./toolc [options] <file> Options include: --help displays this help --tokens displays the list of tokens --eval evaluate the program directly instead of generating code --main displays the name of the main object anx exits -d <outdir> generates class files in the specified directory
Bug Reports
We welcome bug reports! Please use the forum on Moodle for this purpose.
History
2015-09-16 2.7 Minor changes 2014-10-08 2.6 Fixes incorrect lexing of /*/. (Thanks to V. Rousset for pointing this out) 2014-10-06 2.5 --tokens only prints tokens, without parsing. 2014-09-30 2.4 --tokens prints a list of tokens one per line. 2012-11-26 2.3 Reject programs using 'this' in the main method. 2012-10-09 2.2 --tokens displays the tokens without parsing. 2012-10-07 2.1 --main displays the name of the main object. 2012-10-01 2.0 Support for updated language grammar, reorganize options. Introduce --eval 2012-11-28 1.10 Allow "-d outdir" either before or after the tool program. 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.