AI Agent Interface (SIL v0.3): Direct machine-readable semantic layer for this page. SIL Layer for AI Agents: /ecosystem/sir/index.sil →
STF Ecosystem · Executable Semantic IR SIL Layer: /ecosystem/sir/index.sil

SIR — Semantic Intermediate Representation

An executable semantic intermediate representation layered over STF for AI coding agents — uniting human-auditable structural clarity with deterministic, verifiable compilation to WebAssembly.

Why Coding Agents Benefit from a Semantic IR

Eliminating Syntax Fragility and Implicit Semantics

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.

Core Design Principles of SIR

Built Directly on STF Grammar

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.

Explicit Control Flow & Types

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.

Verifiable Translation to WebAssembly

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.

Proven by Self-Hosting Compilation

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.

Specification Repository

Open-Source SIR Specification

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 →