ObjectIR and DocIR
ObjectIR and DocIR
Section titled “ObjectIR and DocIR”sigMAX can separate business data from document rendering.
sigMAX distinguishes two intermediate representations.
| Representation | Purpose | Typical output |
|---|---|---|
| ObjectIR | Structured business objects and typed data produced by runtime logic. | API responses, validation payloads, event data. |
| DocIR | Document-oriented representation for Markdown, HTML, PDF, or other rendered outputs. | Documentation, reports, generated pages. |
This separation keeps generated documents traceable without mixing presentation with business state.
ObjectIR is useful for APIs and structured processing. DocIR is useful for generated documentation, reports, and user-facing documents. Both can be validated, transformed, and rendered by the runtime.
%%{init: {"theme": "base", "flowchart": {"nodeSpacing": 58, "rankSpacing": 78, "padding": 18}, "themeVariables": {"lineColor": "#f8fafc", "clusterBkg": "rgba(15, 23, 42, 0.14)", "clusterBorder": "#38bdf8"}, "themeCSS": ".cluster rect{rx:0!important;ry:0!important}.cluster-label p{font-size:16px!important;font-weight:900!important;letter-spacing:0!important;color:#020617!important}.nodeLabel p{font-size:14px!important;font-weight:850!important;line-height:1.15!important}.flowchart-link{stroke:#f8fafc!important;stroke-width:5px!important;stroke-linecap:round!important;filter:drop-shadow(0 1px 2px rgba(0,0,0,.65))}.marker{fill:#f8fafc!important;stroke:#f8fafc!important}.edgeLabel,.labelBkg,.edgeLabel span{background:transparent!important}.edgeLabel rect{fill:transparent!important;stroke:transparent!important}.edgeLabel p,.edgeLabel .labelBkg p,.edgeLabel span p{background:transparent!important;color:#f8fafc!important;padding:0!important;font-size:14px!important;font-weight:850!important;line-height:1.15!important;text-shadow:0 1px 3px rgba(0,0,0,.95),0 0 5px rgba(0,0,0,.85)!important}"}}%%
flowchart LR
classDef input fill:#fff4cc,stroke:#b7791f,stroke-width:2px,color:#111,font-size:13px,font-weight:800;
classDef contract fill:#ede9fe,stroke:#6b46c1,stroke-width:2px,color:#111,font-size:13px,font-weight:800;
classDef deterministic fill:#e6fffa,stroke:#2c7a7b,stroke-width:2px,color:#111,font-size:13px,font-weight:800;
classDef container fill:#fef2f2,stroke:#c53030,stroke-width:2px,color:#111,font-size:13px,font-weight:800;
classDef runtime fill:#f7fafc,stroke:#2d3748,stroke-width:3px,color:#111,font-size:13px,font-weight:800;
classDef agreement fill:#f0f9ff,stroke:#0369a1,stroke-width:2px,color:#111,font-size:13px,font-weight:800;
Runtime[("Rust runtime<br/>host primitives")]:::runtime
subgraph ObjectState["Business state"]
direction TB
ObjectIR[/"ObjectIR<br/>typed objects"/]:::contract
CRepr["c_repr<br/>binary layout"]:::deterministic
end
subgraph DocumentState["Document state"]
direction TB
DocIR[/"DocIR<br/>renderable document"/]:::agreement
Rendered[/"Markdown<br/>HTML<br/>PDF"/]:::input
end
Validation{"Validation"}:::agreement
Runtime -->|"produces"| ObjectIR
ObjectIR -->|"encodes for WASM"| CRepr
CRepr -->|"decodes"| ObjectIR
ObjectIR -->|"projects"| DocIR
ObjectIR -->|"checks shape"| Validation
DocIR -->|"checks document"| Validation
DocIR -->|"renders"| Rendered
Validation -->|"accepts or rejects"| Runtime
style ObjectState fill:#dcfce7,fill-opacity:0.34,stroke:#2f855a,stroke-width:3px,stroke-dasharray:8 6,color:#020617
style DocumentState fill:#99f6e4,fill-opacity:0.34,stroke:#0d9488,stroke-width:3px,stroke-dasharray:8 6,color:#020617
linkStyle default stroke:#f8fafc,stroke-width:5px,color:#f8fafc
ObjectIR and Binary Layout
Section titled “ObjectIR and Binary Layout”ObjectIR is the structured value model used by the runtime.
When a route expects or returns a typed binary object, the runtime can translate between JSON-like ObjectIR data and a compact c_repr buffer. This buffer is suitable for WASM modules compiled from a deterministic C subset because both sides can agree on field offsets, primitive numeric types, booleans and fixed-size character arrays.
The important separation is:
| Layer | Responsibility |
|---|---|
| Rust runtime | Implements host primitives, validates inputs, encodes and decodes typed values, and controls access to runtime capabilities. |
c_repr layout |
Defines the binary memory representation exchanged with WASM for selected typed values. |
| WASM module | Executes sandboxed logic and reads or writes values through explicit primitive imports. |
| ObjectIR | Keeps business values structured and typed before or after binary encoding. |
| DocIR | Keeps rendered document state separate from business objects. |
So sigMAX does not split primitives into “C primitives” and “Rust primitives”. The primitives are runtime capabilities implemented by the Rust host. The C-compatible part is the ABI layout used for deterministic WASM exchanges.
- typed business data;
- stable structure for APIs;
- validation-friendly payloads;
- useful for events, object responses, and runtime state.
- document-oriented structure;
- renderer-independent content model;
- useful for Markdown, HTML, PDF, and reports;
- keeps presentation traceable from generated state.