Back to browse
GitHub Repository

A Rust compiler with ownership checking, written in PHP

307 starsPHP

Rust compiler in PHP emitting x86-64 executables

by mrconter11·Mar 1, 2026·66 points·50 comments

AI Analysis

●●●BangerWizardryBig Brain

Full Rust ownership checking and code generation in PHP; technically audacious, practically hilarious.

Strengths
  • Implements non-trivial language semantics (ownership, borrow checking, move semantics, traits) end-to-end in a single parser.
  • Direct x86-64 binary emission bypasses LLVM entirely—demonstrates deep understanding of machine code generation.
  • Supports generics, closures, pattern matching, and modules; more complete than a typical compiler toy.
Weaknesses
  • Fundamentally a proof-of-concept; no real-world utility compared to rustc and slower execution.
  • Missing tuples, Vec, floating-point, and most integer types limits practical Rust subset compatibility.
Target Audience

Constraint enthusiasts, demoscene programmers, educators teaching compiler design.

Similar Projects

Open Source●●Solid

PowerBasilisk: Open x64 PowerBASIC in Rust generates LLVM

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.

WizardryNiche Gem
benstopics
353mo ago
Developer Tools●●●Banger

I built a PHP-to-native compiler (written in Rust); now it runs DOOM

Compiles PHP to native ARM64 and renders DOOM E1M1 at 15 FPS—yes, really.

WizardryZero to OneRabbit Hole
nahime
332mo ago