Expand description
Code in static chunks: the flat form of one compile (see
docs/done/2026-10-11_elly-ctx-chunks.md).
A StaticChunk holds a top module and the modules nested in it as flat
tables of small Copy entries, which refer to each other by u32 ids. The
parser emits a chunk as it reads the Muon tree (parse.rs), and a chunk
renders as s-expressions for the parse goldens and as tagged JSON for the
playground.
The tables are filled in post-order: emitting a node pushes its descendants and returns its own node unpushed, and the parent pushes its children’s nodes as one run, then itself. Every operand then points below the entry that holds it, which is what makes a chunk valid by construction. Module entries are the exception: each is reserved when its walk starts and filled when it ends, so a module’s parent comes before it and the top module is the first.
In debug builds a barrier entry stands before each run and records its kind and length, and the run accessors assert that it matches. Indices therefore differ between debug and release builds.
Structs§
- Capture
- A captured free variable:
outeris the de Bruijn index in the enclosing activation at evaluation;slotis its position in the closure’s frame. The plan is sorted byouterso the evaluator fills the frame in one linear walk of the environment. - Capture
Id - One entry of a lambda’s capture plan.
- ChunkId
- A chunk in its realm’s table.
- FrameId
- A frame slot’s name.
- IdRange
lenentries of one table, starting atfirst. An empty range starts at the table’s length when it was made.- Import
Id - An import’s spec.
- IntId
- A big integer literal.
- Lambda
- The code of an abstraction. Its arity is
head.len. - Lambda
Id - A lambda’s head, body and capture plan.
- Member
- A module member. An iota has no body: its
nodeisNodeId::NONE. - Member
Id - A module member: an item, a local or an iota.
- ModId
- A module: the top module, or a nested one such as a
recurgroup. - Module
- A module of the chunk: the top module, or a nested one.
- NodeId
- An expression node.
- PatId
- A pattern.
- Static
Chunk - One compile, flat and immutable: see the module documentation.
- StrId
- A string literal.
Enums§
- Home
Leaf - Home-module leaf types: the module itself (
Self), construction (#Self(…)), or payload read (x.Self). These share the same resolution machinery (one walk to the terminal) and differ only in their eval result. - Node
- An expression: a tag and up to three
u32operands, 16 bytes. Children are ids into the same chunk; a node with many children names a run. - Pat
- A pattern, 16 bytes like
Node. - Plan
- How a closure captures its environment.
- Run
- What a run of nodes or patterns belongs to, recorded by its barrier in debug builds.
Traits§
Type Aliases§
- Text
- An owned, cheap-clone text leaf using hipstr’s
Local(Rc) backend. Short strings (≤ 23 bytes on 64-bit) are inlined; longer strings use a sharedRc<str>slice. This keeps chunks andValue'staticand independent of the Muon source.