Expand description
SExprValue — the typed S-expression input handle (ADR-023 amended
by ADR-060).
Under ADR-060 the S-expression realization no longer copies a
structurally-tagged byte form into a fixed buffer. The host-boundary
parser SExprCanon::validate checks the grammar in a single pass
over the borrowed input — balanced parentheses (tracked with an
unbounded usize depth counter), well-formed canonical atoms, exactly
one top-level value — and the input handle then flows through the
pipeline as a [TermValue::Stream] carrier (SExprCanon). The
carrier re-tokenizes the borrowed bytes on demand and emits Rivest
canonical S-expression bytes chunk-by-chunk; ψ₉ folds those chunks
through the σ-axis with bounded resident memory. There is no input
size ceiling, no atom-width cap, no element-count cap, and no nesting
depth cap.
§Input syntax
SExprCanon::validate admits two equivalent surface syntaxes:
- Canonical (Rivest 1997 §4.3) —
<n>:<bytes>for atoms,(<value> <value>)for cons,()for nil. - Token list — whitespace-separated tokens between parentheses, each token interpreted as an atom whose bytes are the token’s UTF-8 representation.
§Canonical form
The carrier emits Rivest’s canonical S-expression form: atoms as
<n>:<bytes> (raw length prefix, no quoting), proper lists as
(s₁ s₂ … sₙ) with single-space separators, nil as (). The
emission is a streaming structural rewrite — element order is
preserved, so it is reproducible chunk-by-chunk from the borrowed
input with no intermediate buffer.
Structs§
- SExpr
Canon - The Rivest-canonical-form [
ChunkSource] over a borrowed, grammar-validated S-expression byte slice. Constructed bycrate::sexp::addressafterSExprCanon::validatesucceeds; lives in the caller’s stack frame while the model folds it. - SExpr
Value - Typed S-expression input handle (ADR-060 stream carrier). A thin,
Copyborrow of aSExprCanon;as_binding_valuereturns theStreamcarrier zero-copy.
Functions§
- canonicalize
- Validate
rawand materialize its Rivest canonical S-expression bytes — the same byte sequence ψ₉ folds through the σ-axis.