Expand description
The content-addressed AST node model.
A node references its children by their content hash, so a node’s own hash
covers the hashes of everything beneath it — the Merkle property the store
relies on (docs/design.md Section 7). Two structurally identical subtrees
therefore have the same hash and are stored once.
This is the v0.1 seed model. It now carries the Section 4 function contract
(given/produces/requires/on_failure) so the checker can enforce it.
A signature is part of a function’s identity, so Param/Produces are
inlined into the Function node rather than being separate nodes. Record
and variant definitions, generics, and operators are later slices.
Structs§
- Match
Arm - One arm of a
match: a variant case, names bound to its payload fields (in declaration order), and the body evaluated when that case matches. - Node
Hash - A content hash: the lowercase hex SHA-256 of a node’s canonical bytes.
- Param
- One declared input: its name, type, and the minimum confidence a caller
must supply (the
givenclause). - Produces
- The
producesclause: the output type and the confidence it carries.
Enums§
- BinOp
- A binary operator. Arithmetic operands and result are
Number; comparison operands share a type and the result isBool; logical operands and result areBool(short-circuit). Deliberately small (Principle 9): one canonical operator per operation. - Node
- A stored AST node. Compound variants reference children by
NodeHash.