William Kirkman-Moller
I designed X-Lang and built an LLVM optimiser to investigate how a compiler can rewrite whole parts of a program for speed. My approach combines facts the compiler can infer with contracts it checks at the programmer’s request. After one rewrite changes the code, which facts can the next rewrite still rely on? I use X-Proofs to verify selected transformations in Lean. I also build NATP for automated theorem proving in Rust and SODA for comparing executable definitions of program behaviour.
My interests include lambda calculus, type theory, category theory and proof theory. I study operational, denotational and axiomatic semantics, and how type and effect systems, program logics, static analysis and abstract interpretation can establish when an optimisation preserves behaviour.
You can read all my papers on Zenodo.
You can find my code on GitHub.
Projects
-
Parson
Parson turns a folder of music into a library you can search and play from a browser. You host it alongside your collection and stream the recordings straight from your own files.
-
X-Lang
I built X’s compiler in Rust, from parsing and type, effect and borrow checking through native code generation with LLVM. Its ten checked language constructs cover purity, exclusive ownership, record invariants, error handling, overload resolution, tail calls, compile-time specialisation, memoisation, data layout and parallel execution.
The optimiser also works on ordinary LLVM IR. It can specialise an interpreter for a fixed program so it no longer decodes the same instructions at runtime. On a Game Boy emulator benchmark, automatic rewrites delivered a 2.36× speedup over the C reference without changing the source. In a separate prototype, inferring which inputs affect a result gave a 3.87× median speedup over using every argument as a cache key on a single-threaded benchmark.
-
X-Proofs
I formalised two X compiler transformations in Lean 4. For records split into columns, I proved that a write through a borrowed field updates the right record and fails at the same point if it breaks an invariant. For concurrent memoisation, I proved that completed calls return the uncached result even when workers miss the cache together or their keys collide, provided lookup and publication are atomic.
-
SODA
I created SODA while working out the semantics of X. It lets me define how a program steps, what it denotes and which assertions hold after it runs. For a small language with mutable state, I connected all three accounts in Lean. I also used SODA to exhibit a compiler rewrite that fails when its assumption about integer overflow is wrong.
-
NATP
I built NATP so a Rust test can ask whether an equation holds for every input. For sequences built with concatenation and reversal, the prover reduces both sides to a canonical form. I proved in Lean that this procedure is sound and complete, and that every false equation has a counterexample with at most two elements per input sequence. That bound is tight.
Papers
-
X: A Programming Language That Makes Optimisation Explicit
This paper presents X’s ten semantic constructs and studies how effects, ownership and record invariants constrain optimisation. On option valuation with repeated inputs, caching and parallel execution gave a median 5.20× speedup over serial, uncached C compiled with Clang at -O3. In a separate portfolio scan, storing fields in columns gave a 4.38× speedup over storing whole records together.
-
X Proofs: Checked Layouts and Memoised Parallel Calls
Lean proofs show that splitting records into columns preserves the outcome of writes through borrowed fields, including which write first fails. They also establish when concurrent memoised calls return the same values as uncached calls.
-
-
SODA: A Language for Executable Semantics
SODA runs and compares different semantics for the same language. For a small language with mutable state, Lean proofs connect execution rules, mathematical meanings and Hoare logic. An account-transfer example uses those results to prove conservation of balances.
Other projects
Game engines and graphics
-
2D game engine
I built this engine in Rust to bring drawing, input and physics into one game loop. Entities carry components for things like position and velocity, so the same object can move, collide and appear on screen.
-
3D game engine
This engine draws a world one triangle at a time. As you move the camera, it projects mesh vertices onto the screen and uses a depth buffer to decide which surfaces are visible.
-
Voxel engine
A terrain renderer that builds a block world in chunks as you move through it. Noise determines the landscape, while ambient occlusion gives corners and crevices their shadows.
-
Ray tracer
A renderer that follows rays from the camera into a scene. The material at each intersection determines how light contributes to the final pixel.
-
Ray-traced audio
This experiment follows sound as it bounces off surfaces. Each reflection absorbs some energy, so the path through the room changes how much sound reaches a listener.
-
Rollback netcode
A game can keep moving while it waits for another player’s input. When the input arrives, the simulation goes back to the affected frame and plays it forward with the correct moves.
Languages and systems
-
CPU
I designed a 32-bit instruction set and a three-stage processor that runs it on an FPGA. A Rust assembler and emulator let me write and test the same programs before trying them on the hardware.
-
ParsonLabs OS
An x86-64 operating system I wrote in Rust, from the bootloader up to a graphical desktop. Its Linux compatibility layer can run Doom.
-
Bytecode VM
A small machine for exploring how an interpreter works. An assembler turns instructions into bytecode, and a stack-based interpreter carries out arithmetic, jumps and variable access.
-
LLVM IR viewer
A reader for LLVM’s intermediate language. You can follow a symbol to its definition while tracing the code a compiler produces.
-
Static single assignment
A compiler pass that gives each assignment its own name. Where control-flow paths meet, it works out which values need to be joined by a phi function.
-
Garbage collector
A visual model of a mark-and-sweep collector. You can follow references through a graph of objects and see which allocations survive a collection.
-
Unused
A source analysis tool that looks for variables and functions left unused. It applies the same question to code written in languages including Rust, Go, Python and TypeScript.
Browsers, applications and databases
-
Seven
I built Seven around the Gecko browser engine. It arranges tabs vertically and includes an ad blocker in the browser itself.
-
HTML and CSS renderer
A small browser rendering engine that turns markup and style rules into pixels. Its editor lets you change the HTML or CSS and watch the page being laid out and drawn.
-
ParsonLabs Video
A personal video library you host yourself. It gives your collection a web interface for browsing and watching videos.
-
Database engine
A SQL database built around transactions, disk pages and B-tree indexes. It takes a query from a logical request for rows down to the pages where those rows live.
-
Distributed key-value store
A key-value store spread across several nodes. It uses Raft so the nodes agree on which changes to apply and in what order.
Emulators for nine systems
-
Nintendo 64
A Nintendo 64 emulator that translates MIPS instructions into native code and draws frames with Vulkan. It also saves Controller Pak data between sessions.
-
Nintendo DS
DS games divide work between two processors and can take input from a touchscreen. This emulator keeps the processors in step and brings that interaction to the desktop and browser.
-
PlayStation
An emulator for the original PlayStation. The virtual MIPS processor works alongside models of the graphics and sound hardware, and games can save their progress to a virtual memory card.
-
Game Boy Advance
An emulator for the ARM-based handheld. The timing of the CPU, graphics hardware and memory transfers determines when a game sees each frame and interrupt.
-
Game Boy and Game Boy Color
These handhelds share a processor family but differ in how they draw a frame. The emulator follows the LCD pipeline and handles the Color model’s palettes and switchable CPU speed.
-
Super Nintendo
This emulator models the Super Nintendo’s processor and graphics layers, including the Mode 7 hardware that games use to rotate and scale a background.
-
Nintendo Entertainment System
The CPU runs game code while the picture processor draws the screen a scanline at a time. Cartridge mappers let games switch which parts of their ROM are visible to the console.
-
CHIP-8
A compact interpreter for games written for the CHIP-8 virtual machine. It draws monochrome sprites, reads a sixteen-key keypad and keeps the delay and sound timers ticking.
Linux Syscalls
-
eventfd
A small experiment in using a file descriptor as a counter. Write several events, then read them back as a total or consume them one at a time in semaphore mode.
-
timerfd
This program turns a periodic timer into something a process can read. Each read reports how many ticks have elapsed, including any that accumulated while the process was busy.
-
inotify
A file watcher that follows changes in a directory. It uses the kernel’s rename cookies to connect a file’s old name with its new one.
-
mincore
A way to inspect which pages of a mapped file are already in memory. It reports resident ranges so you can see where the file is cached.
-
pidfd
This tool watches for a process to exit using a file descriptor that refers to that particular process. The reference stays unambiguous even if Linux reuses its numeric PID.
-
lseek
An inspector for sparse files. It asks the filesystem where data starts and where holes begin, then prints the byte ranges it finds.
Algorithms
-
Data structures and algorithms visualised
A collection of visual demonstrations for studying how algorithms operate on data structures, alongside implementations in JavaScript, Python and Rust.
-
Aho-Corasick string matching
A dictionary matcher that searches for many words in one pass through a text. Shared prefixes and fallback links let it keep scanning when a partial match fails.
-
DPLL SAT solver
A solver that searches for a truth assignment satisfying a Boolean formula. It propagates forced choices and backtracks when a choice leads to a contradiction.
-
Dinic’s maximum-flow algorithm
Finds how much flow a network can carry between two vertices. Each round builds a layered graph and pushes flow through it until the shortest routes are blocked.
-
Cooley-Tukey FFT
A fast Fourier transform that breaks a signal into smaller transforms, then recombines their results to recover the signal’s frequency components.
-
Convex hull
A Graham scan implementation that finds the outer boundary of a set of points. It walks the points in angular order and removes turns that lead into the interior.