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§
Trait Implementations§
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.
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§impl Drop for Exp
Deep trees are ordinary in staged output, so recursive drop glue would
overflow on residuals the specializer routinely produces.
impl Drop for Exp
Deep trees are ordinary in staged output, so recursive drop glue would overflow on residuals the specializer routinely produces.