scrml.dev v0.7.1
scrml.dev

Reference

Every element, keyword, context, and error code in scrml. Reference pages summarize SPEC.md at MDN-rigor; SPEC.md is authoritative when they disagree.

Elements

Scrml-defined structural elements. NOT HTML — the grammar treats them as first-class language constructs. See SPEC §4.15 + §24.4 for the registry.

  • <engine> — Tier 2 state machine. The canonical structural form for UI as a fully-handled state machine.
  • <match> — Tier 1 pattern matching. Structural exhaustiveness, no active rules; promotes mechanically to <engine>.
  • <errors> — First-class element for rendering the auto-synthesized validity surface.
  • <program> — The root container. Owns route inference, middleware, channels, documentary metadata.
  • <channel> — Real-time multi-client state. V5-strict body, auto-sync, no @shared modifier.
  • <auth> — Per-role visibility constraint. Drives the per-route per-role artifact splitter.
  • <onTransition> — Engine effect element. Runs at transition commit; filterable by from / to / once / if.
  • <onTimeout> — Per-state-child timer. Armed on entry, cleared on exit. Optional name= for cancellation.
  • <onIdle> — Engine-wide event-timeout watchdog. Armed at module-init, reset on every successful transition.
  • <page> — Route declaration. Filesystem-routed; path= overrides. Per-route per-role artifacts.
  • <schema> — Declarative DB schema. SQL-mirror canonical plus additive shared-core validators; migration diff at compile time.
  • <onTimeout>, <onIdle> — engine temporal surface (per-state timeout + engine-wide idle watchdog).

Contexts

Braced regions that switch the grammar mode. Each context has its own dialect; the compiler dispatches by the opener.

  • ${ ... } — Logic. The foundational context; reactive computation, control flow, inline writes.
  • ?{ ... } — SQL. Per-handler coalescing, N+1 loop hoist, multi-database adaptation.
  • ^{ ... } — Meta. Compiler-directed annotation on a declaration.
  • #{ ... } — CSS. _{ ... } — foreign code. — not yet documented here.

Keywords

Reserved words with normative semantics. Four have their own reference page; the rest are documented in context on the pages that use them.

  • fn, function, lin, pinned, is, not, ˜, reset, fail, default

Two are deprecated and should not be reached for in new code: pure is superseded language-wide by fn, and the server modifier on a function is deprecated in favour of placement inference. (server fn is a different construct and is not deprecated — it stays, for server-pinned helpers.)

Error codes

Every error code the compiler can emit has a definition in SPEC §34. 54 codes have their own page here, grouped into families in the sidebar — each with the full message, when it fires, and a minimal repro. The normative catalog lives at compiler/SPEC.md section 34.

How to read these pages

  • Each feature page follows an 8-section template: summary, syntax, worked example, semantics + errors, edge cases, related features, availability, spec link.
  • Worked examples are real scrml. Examples target the current compiler and the canonical language shape; where a feature's runtime is still landing, the page says so.
  • SPEC.md is the authority. When a reference page disagrees with SPEC.md, the spec wins. Surface the contradiction and we'll fix the docs.