Rust compiler in PHP emitting x86-64 executables
Full Rust ownership checking and code generation in PHP; technically audacious, practically hilarious.
An LLVM backend implementation targeting the Zilog Z80 processor
Complete LLVM backend for Z80 outperforms SDCC, unlocks Rust on Game Boy.
Retro developers, compiler engineers, Game Boy hobbyists
SDCC · LLVM-CBE · gbdk
At the time, no stable LLVM backend supported the Game Boy’s CPU.
I had to use a complex workaround: transpiling Rust to C via LLVM-CBE and then compiling that C code using SDCC.
Back then, building a native LLVM backend was a dream, but I lacked the time to do it alone.
Fast forward two years, and things have changed.
With the help of LLMs, I have successfully implemented a complete LLVM-Z80 backend, including subtarget support for the Game Boy's SM83.
In terms of performance, it generally outperforms SDCC, though it currently produces larger binary sizes.
While there are still some latent bugs and upstream LLVM core issues to address, I’ve successfully compiled most C programs and the entire Rust core library.
I’d love to hear your feedback or any questions regarding the backend!
- LLVM-Z80: https://github.com/llvm-z80/llvm-z80 / Rust-Z80: https://github.com/llvm-z80/rust-z80
Full Rust ownership checking and code generation in PHP; technically audacious, practically hilarious.
Korean keywords for programming when English dominates every other language.
Full Rust compiler in 2.5K lines of PHP—technically impressive but niche hobby project.
Turning an old PowerBASIC toolchain into plain-text LLVM IR is a clever, low-friction modernization strategy — the frontend avoids LLVM bindings entirely and emits readable IR you can inspect before invoking clang. Including a Rust-based interpreter (pbinterp) for unit testing and choosing to wrap rather than rewrite a massive codebase like Wall Street Raider shows practical engineering judgment and real technical muscle.
C runtime + Python metaprogramming: pointer math and manual memory in Python syntax.
Another systems language when Rust, Zig, and Odin already dominate this space.