Skip to main content

ExprSpace

Struct ExprSpace 

Source
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

Source

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.

Source

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.

Source

pub fn grammar(&self) -> Arc<dyn Shape>

Returns the Shape grammar used as this space’s membership oracle.

Source

pub fn seed_corpus(&self) -> Vec<Expr>

Returns the curated seed corpus this space contains.

Source

pub fn describe_grammar(&self, cx: &mut Cx) -> Result<ShapeDoc>

Returns a browsable description of this space’s membership grammar.

Source

pub fn max_depth(&self) -> usize

Returns the maximum expression depth used by enumeration.

Source

pub fn contains(&self, cx: &mut Cx, expr: &Expr) -> bool

Returns true when expr is a member of this space.

Source

pub fn enumerate(&self, budget: usize) -> Vec<Expr>

Deterministically enumerates distinct in-space expressions in size order.

Enumeration is stable for the same (space, budget) input.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.