Skip to main content

Crate vize_l2

Crate vize_l2 

Source
Expand description

L2 - the Davinci semantic IR (codename Disegno): the pivot stage and the primary consumer surface.

Experimental: the stage API may change in any alpha release; record intentional breaking changes in the release notes.

Named after Leonardo’s disegno: the drawing that carries the idea, independent of the material it is later executed in.

L2 is the normalized, input-neutral representation of UI semantics (docs/davinci/architecture.md, “L2 — Disegno”). Vue templates, JSX and pug all lower into the same op family; whatever is genuinely Vue-specific stays a vue.* dialect op instead of shaping the core. The Vue template lowering into this family is vize_l1_to_l2 (codename Ricalco; P2-8); this crate holds the type family, its folio page, the invariants that are enforceable by construction, and the verifier for the ones that are not:

  • op — the op enums (op::Op, op::BindingOp) and their payload types, arena-resident and Drop-free by construction through vize_l0::{Box, Vec} (whose const assertion rejects Drop payloads; P1-10 measured it catching two real violations).
  • expr — expr::ExprRef, the expression reference: retained JS AST, foreign dialect (type-only until phase 6), or the classified escape with pessimal documented semantics (P2-5b’s decision; record in docs/davinci/plan/phase-2-records/p2-5b.md).
  • dump — crate::dump::Page, the L2 stage dump (docs/davinci/plan/folio-format.md, “Disegno page”).
  • verify — the between-pass invariant checks (P2-6), debug/CI only: local in the GHC -dcore-lint sense, and never in a release build.
  • scope / provenance — the side-table vocabulary lowerings attach beside the tree (P2-8): hygiene scope tags on binding-introducing ops, and before/after provenance records that survive failure. Neutral types here so every input dialect’s lowering (Vue today, JSX at P2-16) speaks the same facts.

The crate is no_std + alloc from birth so L2 artifacts print and parse on any target (wasm32-wasip2 included; P2-14 makes that lane required).

Modules§

artifact
Native canonical L2 ownership, independent of a dialect legalizer.
dump
The L2 folio: the stage dump.
expr
The L2 expression reference (P2-5b): ExprRef and its payload family.
file
File-local semantic facts sealed with their actual canonical artifact.
lang
Language-specific L2 expression semantics.
op
The L2 op family: one concrete typed enum per position, never a uniform Operation structure (docs/davinci/architecture.md, “What we take from MLIR, and what we refuse”).
provenance
Lowering provenance: before/after pairs per lowering decision, surviving failure (P2-8).
resolution
Checked identifier uses from an already retained expression AST.
scope
Hygiene scope facts: the side-table vocabulary for binding-introducing ops (P2-8).
summary
The per-SFC summary (P5-2) — one component’s GHC .hi interface.
verify
The L2 verifier: local invariant checks between passes, debug/CI only.
walk
The page-order re-derivation walk the L2 passes share.