An executable semantic intermediate representation layered over STF for AI coding agents — uniting human-auditable structural clarity with deterministic, verifiable compilation to WebAssembly.
Traditional programming languages pack dense operator precedence rules, overloaded punctuation, implicit type coercions, and macro expansions into terse line noise. When an AI coding agent modifies complex systems code, minor syntactic slips or context window truncations easily introduce subtle control-flow or memory bugs.
SIR represents executable programs using STF's explicit section tree. Every module, signature, local binding, control-flow branch, and memory operation is an explicit semantic node with unambiguous keywords and zero hidden precedence traps.
Every valid SIR program is a valid STF tree. Coding agents inspect, refactor, and synthesize code as named semantic sections rather than wrestling with mismatched braces, semicolons, or intricate lexer states.
Types, mutability, function signatures, and branching constructs are spelled out in self-contained blocks. Any fragment of a SIR file remains locally comprehensible even when viewed outside the surrounding file.
SIR maps cleanly and deterministically to the WebAssembly execution model (linear memory, structured control flow, explicit numeric operations), enabling portable, sandboxed execution and straightforward verification.
SIR is not a theoretical toy language: the entire production SIR Compiler is written in SIR itself and compiles itself to a byte-for-byte identical WebAssembly binary.
Read the full language specification, semantic node definitions, and WebAssembly lowering semantics on GitHub:
https://github.com/ais-space/sir → See Self-Hosting SIR Compiler →