Joseph Osako
started 2008:06:13
last modified 2008:06:13 J Osako
Suntiger is a compiler for a dialect of the Baby Algol language defined in the CS4110 course for Spring 2008 at CSU East Bay by Dr. Edna Reiter. The implementation was written by Joseph Osako in the Python language. The compiler, a simple recursive-descent direct emitter, produces code targeting the SPIM simulator, a simulated version of the MIPS processor.
The compiler consists of a set of pre-compiled Python modules, and a driver script, 'suntiger.py'. It is distributed as a directory archive, either a Zip file or a tarball. To install the program, extract it to a given directory with the directory structure retained.
The Suntiger compiler is a command-line or shell program. It can be run in Windows or Unix as
python suntiger.py <filename>
where
./suntiger.py <filename>
In order to use the script in this manner, it is first necessary to set the execution privileges for the script, as so:
chmod +x suntiger.py
After this the program should be runnable from the shell.
The compiler will try to find a file named
For example, if you have a program 'test.al', you would run the compiler
as
This will compile the test.al file to a SPIM assembly source file named
test.s and a listing file test.lis.
The source file is a text file of SPIM assembly code, which can be run
as with any SPIM program. Consult the SPIM manual for details on running
the compiled program.
The listing file consists of a formatted listing of the program, with all
non-string elements converted to upper case and all comments removed. The
compiler automatically formats the listed program. The code listing is
followed by a listing of the symbol table for the program.
python suntiger.py test
If a fatal error is encountered, the compiler will print the error message to both standard output and the listing, and will halt compiling. The symbol table as it is at the time of the error is written to the listing file after the error message. The output file is emptied but not removed.
Parts of the Suntiger code use the typecheck.py module written by
Dimitri Dvoinikov