A lightweight compiler for the Decaf programming language.
You will need a GNU compiler in your $PATH
installed to compile. Cygwin or MinGW-w64 should be sufficient for compiling on Windows machines, as Walrus is POSIX-compatible and uses minimal library functions.
All builds and tests are done using GNU make. To compile all sources and produce an executable, simply run:
make
That's it. No crazy stuff.
You can run all tests by running:
make test
Sets of input files will be compared to expected output files to find any errors with scanning. You can also run individual tests for the scanner and parser separately:
make test-scanner
make test-parser
To compile a Decaf program, pass the source code files to Walrus:
bin/walrus inputfile1 inputfile2...
To just run the scanner, set the -s
option. You can also pass the -T
option along with -s
to print out the scanned tokens to STDOUT for testing and debugging purposes.
Below are all command line options (also accessible with --help
):
--help
: Displays the help message--debug
: Outputs debugging information-p
: Scan and parse, but do not analyze-s
: Scan only; do not parse or compile-T
,--print-tokens
: Print out tokens as they are scanned