anas-alshanti-169265.jpg

WACC Compiler

A compiler written in Java 8 for the WACC programming language.

anas-alshanti-169265.jpg

WACC Compiler

A compiler written in Java 8 for WACC, a fully featured programming language with a syntax similar to Ruby.


dmitri-popov-69420.jpg

SUPPORT FOR CLASSES

We extended WACC to support object-oriented classes, which involved designing an entirely new syntax to add support for fields and methods. It was also necessary to promote WACC's simple pair-heap to a heap with full support for objects.

cpu-processor-electronics-computer-51165.jpeg

EFFICIENT REGISTER ALLOCATION

I was responsible for writing the register allocator, which resulted in a >100x increase in the speed of the generated assembly code versus the equivalent stack machine. I implemented the Linear Scan algorithm to rapidly allocate registers in O(n) time, compared to exponential approaches based on graph colouring.

STANDARD FUNCTION LIBRARY

We built a highly optimised standard library for WACC written in ARM assembly. The library adds native support for sorting arrays, finding min/max elements and index calculations, amongst many other useful functions.

emil-vilsek-377013.jpg

OPTIMISATIONS

Our compiler supports a variety of optimisation options for the generated assembly code which can be selected via command-line flags. Available optimisations include redundant instruction removal and minimisation of stack operations.