Projects

WACC Compiler

A Scala 3 compiler that lowers WACC into optimized x86-64 or AArch64 assembly.

example.wacc
begin
  int answer = 40 + 2;
  println answer
end
example.s / x86-64
main:
  push rbp
  mov rbp, rsp
  sub rsp, 32
  mov edi, 42
  xor eax, eax
  call print_int
  call print_ln
  mov eax, 0
  mov rsp, rbp
  pop rbp
  ret

Scala 3, Parsley, x86-64, AArch64, QEMU

How it works

The compiler parses and type-checks WACC, lowers the typed tree into a shared virtual-register IR, and emits assembly for either target. Its optimisation pipeline includes constant and copy propagation, control-flow cleanup, dead-code elimination, liveness analysis, and graph-colouring register allocation.

My contribution

In a four-person team, I worked on parser and semantic support for types, functions, arrays, and pairs; backend generation for arrays, pairs, and stack-passed arguments; shared stack resolution; and compile-and-run tests.

Next: Room Scanner