A compiler for Pascal to MIPS Assembly written in Java from scratch.
A Pascal compiler with support for
- Integer and boolean arithmetic and comparison
- Variables
- Control flow constructs
- Console output
- Functions/subroutines with scope
An equivalent MIPS Assembly file is outputed. This project was created for ATCS: Compilers and Interpreters at The Harker School, taught by Ms. Datar.
Standard Java libraries.
- Run ParserTester.java from the terminal with two arguments, where
- The first argument is the desired Pascal input filename (.txt)
- The second argument is the desired Assembly output filename (.asm)
- Upon execution, the program will write the compiled Assembly code to the specified output file.
- The program will also print the AST and declaration environment to the console.
Thank you to Anu Datar for providing the original code for Emitter.java and ScanErrorException.java.