Back to browse
GitHub Repository

A Rust compiler with ownership checking, written in PHP

307 starsPHP

A Rust compiler with ownership checking, written in PHP

by mrconter11·Feb 28, 2026·3 points·0 comments

AI Analysis

●●SolidWizardryBig Brain

Full Rust compiler in 2.5K lines of PHP—technically impressive but niche hobby project.

Strengths
  • Ownership and borrow checking in PHP is non-trivial; proves the pattern is language-agnostic.
  • Direct x86-64 code generation (no LLVM) demonstrates deep compiler knowledge.
  • 80+ test cases show rigor; not vaporware.
Weaknesses
  • Practical utility is nearly zero—compiling on shared PHP hosting is an edge case nobody has.
  • Missing critical Rust features (generics, traits, enums, closures) make it a teaching tool, not usable compiler.
Target Audience

Systems programmers, compiler enthusiasts, and developers on constrained hosting environments.

Similar To

LLVM · GCC

Post Description

Hi! I put together a Rust compiler written in PHP. It takes Rust source code and outputs x86-64 Linux binaries directly. No LLVM, no assembler, no linker.

It has a working ownership checker, borrow checker, type checker, structs, functions, control flow, and mutable references. The test suite has 80+ cases. The whole thing is around 2,500 lines of PHP.

Similar Projects

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