pub struct ExprSpace { /* private fields */ }Expand description
A deterministic, sized enumerator of Expr graphs drawn from a
Shape-described space.
The grammar shape is the membership oracle: an expression is in the space
exactly when grammar.check_expr accepts it.
Implementations§
Source§impl ExprSpace
impl ExprSpace
Sourcepub fn r7rs_core_space(max_depth: usize) -> Self
pub fn r7rs_core_space(max_depth: usize) -> Self
Builds the R7RS-small core expression space.
The first space covers booleans, symbols, strings, integer literals, and
list compounds over those atoms, bounded by max_depth.
Sourcepub fn core_round_trip_space(max_depth: usize) -> Self
pub fn core_round_trip_space(max_depth: usize) -> Self
Builds the shared core expression space for codec-neutral round trips.
This space uses the same grammar and atoms as ExprSpace::r7rs_core_space,
but keeps the seed corpus to forms that general expression readers decode
back to the same Expr without syntax lowering.
Sourcepub fn grammar(&self) -> Arc<dyn Shape>
pub fn grammar(&self) -> Arc<dyn Shape>
Returns the Shape grammar used as this space’s membership oracle.
Sourcepub fn seed_corpus(&self) -> Vec<Expr>
pub fn seed_corpus(&self) -> Vec<Expr>
Returns the curated seed corpus this space contains.
Sourcepub fn describe_grammar(&self, cx: &mut Cx) -> Result<ShapeDoc>
pub fn describe_grammar(&self, cx: &mut Cx) -> Result<ShapeDoc>
Returns a browsable description of this space’s membership grammar.