AI Agent Interface (SIL v0.3): Direct machine-readable semantic layer for this page. SIL Layer for AI Agents: /ecosystem/sir-compiler/index.sil →
STF Ecosystem · Self-Hosting Compiler 253/253 Tests · ~103 KB WASM · Fixpoint Proven SIL Layer: /ecosystem/sir-compiler/index.sil

SIR Compiler — Self-Hosting SIR→WASM Compiler

A self-compiling SIR-to-WebAssembly compiler written entirely in SIR itself (~103 KB WASM binary, proven byte-for-byte self-compilation fixpoint, 253/253 test suite passing) — serving as live empirical proof of the STF/SIR architecture's resilience.

Verified Technical Milestones

~103 KB Self-Compiled Binary

The compiler source is authored in SIR and lowers directly into a compact, zero-dependency ~103 KB WebAssembly binary containing the full lexer, STF/SIR tree parser, semantic validator, and WASM binary emitter.

Byte-for-Byte Fixpoint Proven

When the compiled WebAssembly binary compiles its own SIR source code, the resulting stage-2 and stage-3 WASM binaries match byte-for-byte — demonstrating a deterministic self-compilation fixpoint.

253 / 253 Test Suite Passing

Verified across a comprehensive 253-test verification suite covering grammar edge cases, control flow, memory layout, type checking, and multi-stage bootstrap reproducibility.

Empirical Proof of Architectural Durability

Built by Non-Frontier Models Across Repeated Context Autocompressions

Any language looks easy when a frontier model edits a 50-line snippet with the full language manual in prompt. The real test of an agent-native intermediate representation is whether weaker or mid-tier models can build and maintain a complex, self-hosting compiler over long multi-session runs.

  • Written by Tencent Hy3 (200k Context Window): The bulk of the self-hosting SIR compiler was authored by a comparatively weak model — Tencent Hy3 operating within a 200k context window.
  • Final Polishing by Muse Spark 1.3 Under Aggressive Autocompression: Final bring-up and fixpoint convergence were completed by Muse Spark 1.3, which maintained structural and semantic accuracy when writing and refactoring SIR code despite undergoing multiple automatic context compressions without re-reading the SIR specification.
  • Why This Worked: Because SIR encodes semantics explicitly in self-labeling STF nodes rather than brittle punctuation or implicit grammar rules, the model could infer valid structure directly from surrounding code fragments even after the formal specification had been compressed out of active context.

Compiler Repository

Inspect Source Code, Bootstrap Scripts & Fixpoint Tests

The complete SIR source code of the compiler, WebAssembly bootstrap artifacts, and the 253-test verification suite are publicly available on GitHub:

https://github.com/ais-space/sir-compiler → Explore Sir Revizor Code Monitoring →