Skip to main content

vize_l2/
lib.rs

1//! L2 - the Davinci semantic IR (codename Disegno): the pivot stage and the
2//! primary consumer surface.
3//!
4//! **Experimental:** the stage API may change in any alpha release; record
5//! intentional breaking changes in the release notes.
6//!
7//! Named after Leonardo's *disegno*: the drawing that carries the idea,
8//! independent of the material it is later executed in.
9//!
10//! L2 is the normalized, input-neutral representation of UI semantics
11//! (`docs/davinci/architecture.md`, "L2 — Disegno"). Vue templates, JSX and
12//! pug all lower into the same [`op`] family; whatever is genuinely
13//! Vue-specific stays a `vue.*` dialect op instead of shaping the core.
14//! The Vue template lowering into this family is `vize_l1_to_l2` (codename
15//! Ricalco; P2-8); this crate holds the type family, its folio
16//! page, the invariants that are enforceable by construction, and the verifier
17//! for the ones that are not:
18//!
19//! - [`op`] — the op enums ([`op::Op`], [`op::BindingOp`]) and their payload
20//!   types, arena-resident and **`Drop`-free by construction** through
21//!   `vize_l0::{Box, Vec}` (whose const assertion rejects `Drop`
22//!   payloads; P1-10 measured it catching two real violations).
23//! - [`expr`] — [`expr::ExprRef`], the expression reference: retained JS
24//!   AST, foreign dialect (type-only until phase 6), or the classified
25//!   escape with pessimal documented semantics (P2-5b's decision; record
26//!   in `docs/davinci/plan/phase-2-records/p2-5b.md`).
27//! - [`dump`] — [`crate::dump::Page`], the L2 stage dump
28//!   (`docs/davinci/plan/folio-format.md`, "Disegno page").
29//! - [`verify`] — the between-pass invariant checks (P2-6), debug/CI only:
30//!   local in the GHC `-dcore-lint` sense, and never in a release build.
31//! - [`scope`] / [`provenance`] — the side-table vocabulary lowerings
32//!   attach beside the tree (P2-8): hygiene scope tags on
33//!   binding-introducing ops, and before/after provenance records that
34//!   survive failure. Neutral types here so every input dialect's lowering
35//!   (Vue today, JSX at P2-16) speaks the same facts.
36//! - [`analysis`] — backend-neutral computations and canonical fact schemas
37//!   over L2 control and retained expressions. Dialect lowering crates may
38//!   adapt their transitional owners to these analyses without owning the
39//!   product vocabulary.
40//!
41//! The crate is `no_std + alloc` from birth so L2 artifacts print and parse
42//! on any target (wasm32-wasip2 included; P2-14 makes that lane required).
43
44#![no_std]
45
46extern crate alloc;
47
48pub mod analysis;
49pub mod artifact;
50pub mod dump;
51pub mod expr;
52pub mod file;
53pub mod lang;
54pub mod op;
55pub mod provenance;
56pub mod resolution;
57pub mod scope;
58pub mod summary;
59pub mod verify;
60pub mod walk;