Skip to content

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.

Document state

Business state

produces

encodes for WASM

decodes

projects

checks shape

checks document

renders

accepts or rejects

Rust runtime

host primitives

ObjectIR

typed objects

c_repr

binary layout

DocIR

renderable document

Markdown

HTML

PDF

Validation

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.