Minijava


Minijava was a project in the compilers class at Westminster University that had the students design and implement the front end of a compiler to take minijava code and convert it into Java virtual machine assembly so that a different program, jasmin, could convert it into a .class file. This .class file could then easily be run and the output from the program could be seen. I had a lot of fun with this project and learning about compilers in general, but it did require a lot of work to create. The project was broken up over the last two months of the semester, with the first two getting the basics down on how parsing, lexing and adding semantic actions worked both in Java and how we were going to write them for our project. Overall, I enjoyed seeing the incremental progress of putting this compiler together, getting more and more of it working. It was really great when I could first write a normal looking Java program and get it to compile with no errors. Having to figure out precisely how jasmin wanted the assembly code and implementing that into the generator was difficult but extremely rewarding.

A picture of the code required to cast integers to doubles and vice versa as well as from numbers to Strings
A picture of the code required to cast integers to doubles and vice versa as well as from numbers to Strings. The full extent of the code is linked in the section header.