Module core

Module core 

Source
Expand description

Core — the load-bearing IR, and the evaluator that runs it.

docs/04-compiler-architecture.md §4.2: “Typed ANF/SSA hybrid; explicit closures, explicit effect operations, explicit tier annotation per node; Query sub-language kept symbolic. Typechecked semantics, placement, splitting, optimisation. The load-bearing IR.”

Two things stay symbolic here, exactly as §4.2 demands, and for the same stated reason — lowering them early would foreclose Phase 3:

  • Signal and stream operations are Prims (Prim::Fold, Prim::Durable, Prim::SignalMap, …), not loops. A fold that has already become a loop cannot be compiled to an incremental dataflow plan.
  • UI trees are Html values built by Prim::HtmlEl and friends, not DOM mutation calls, so the same value can be server-side rendered, diffed, or (Phase 3) compiled for the client.

§On the backend

The roadmap names Cranelift as Phase 1’s server backend. What is here instead is a Core evaluator: the “engine-in-Rust with the language as its configuration” route that docs/00-original-idea.md names as one of the three that work for a GC’d functional language on a Rust host (Materialize’s shape). It is the deliberately-bad-but-complete option, and it keeps the Core → Target seam narrow, which §5.2 says is what lets a backend slot in later. The Phase 1 report says plainly that native codegen is not done.

Structs§

Arm
One arm of a match. Patterns are shallow — a constructor and its named field binders — which is what §3.1’s exhaustiveness check needs and no more.
Closure
Core
Env
A lexical environment: a persistent chain of frames, so a closure can capture cheaply.
Fields
A record’s fields, sorted by name.
NotStorable
A value that cannot be written to a log.
Record
A model instance or a union variant. variant is None for a plain record.
Text
A string that knows its own length in characters, and whether it is ASCII.

Enums§

AttrValue
Const
CoreKind
Pattern
Prim
A primitive operation. Everything the standard library provides in Phase 1.
Value
A runtime value.

Functions§

digest
Structural digest of a value — the replay-determinism oracle (§4.8).
literal_str
The string this expression is, when it is written as one.
value_from_repr
value_to_repr
A lossless encoding of a Value, for the log and for snapshots.

Type Aliases§

VarId