Exp

Enum Exp 

Source
pub enum Exp {
Show 23 variants Lit(i64), Flo(f64), Sym(SmolStr), Atom(Atom), Nil, Var(usize), Lam(u16, RcExp), App(RcExp, Box<[RcExp]>), Apply(RcExp, RcExp), Let(RcExp, RcExp), If(RcExp, RcExp, RcExp), Prim1(Prim1, RcExp), Prim2(Prim2, RcExp, RcExp), Op(u16, Vec<RcExp>), Lift(RcExp), LiftFun(RcExp, RcExp), LiftRef(RcExp, RcExp), Proc(RcVal), Run(RcExp, RcExp), IsCode(RcExp, RcExp), Evalms(RcExp, RcExp), Catch(RcExp), Throw(RcExp),
}

Variants§

§

Lit(i64)

§

Flo(f64)

In the core rather than behind host because boxing a register-sized scalar is not a constant factor. Costs one match arm.

§

Sym(SmolStr)

§

Atom(Atom)

§

Nil

§

Var(usize)

De Bruijn index, counted from the outermost binding

§

Lam(u16, RcExp)

Binds its own name and then arity parameters, so the body sees arity + 1 bindings. A closure carries this node rather than just the body, which is how the arity reaches the call.

§

App(RcExp, Box<[RcExp]>)

§

Apply(RcExp, RcExp)

Application at an arity not known until the call: the operands arrive as a list value rather than as syntax, which is what an n-ary interpreter has, and Exp::App fixes its arity when it is read.

§

Let(RcExp, RcExp)

§

If(RcExp, RcExp, RcExp)

§

Prim1(Prim1, RcExp)

§

Prim2(Prim2, RcExp, RcExp)

§

Op(u16, Vec<RcExp>)

A call into the host op table, resolved to an index by the reader

§

Lift(RcExp)

§

LiftFun(RcExp, RcExp)

Eta-expand at a stated arity, since an interpreter compiling an object function has no floor closure to take one from. Variables as a list, self first.

§

LiftRef(RcExp, RcExp)

Cross-stage persistence: carry a value into the next stage by reference rather than by structure

§

Proc(RcVal)

A persisted value, the residue of Exp::LiftRef. Syntax that is not syntax: it holds a value the next stage may only pass along.

§

Run(RcExp, RcExp)

§

IsCode(RcExp, RcExp)

§

Evalms(RcExp, RcExp)

The one way to animate code compiled against a scope other than the current one, which is what loading a module amounts to.

§

Catch(RcExp)

§

Throw(RcExp)

Implementations§

Source§

impl Exp

Source

pub fn iter_children(&self) -> impl Iterator<Item = &RcExp>

Trait Implementations§

Source§

impl Clone for Exp

Source§

fn clone(&self) -> Exp

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Exp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Exp

Floor source as read, except the three things with no syntax: a de Bruijn variable, a persisted value, a host atom. Iterative for Drop’s reason.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Exp

Deep trees are ordinary in staged output, so recursive drop glue would overflow on residuals the specializer routinely produces.

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PartialEq for Exp

Source§

fn eq(&self, other: &Exp) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Exp

Auto Trait Implementations§

§

impl Freeze for Exp

§

impl !RefUnwindSafe for Exp

§

impl Send for Exp

§

impl Sync for Exp

§

impl Unpin for Exp

§

impl !UnwindSafe for Exp

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

§

fn to_smolstr(&self) -> SmolStr

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.