pub enum Expr {
Var(VarName),
Lam {
param: VarName,
body: Box<Expr>,
},
App {
func: Box<Expr>,
arg: Box<Expr>,
},
Let {
name: VarName,
value: Box<Expr>,
body: Box<Expr>,
},
Fix {
name: VarName,
body: Box<Expr>,
},
}Expand description
The abstract syntax tree for the lambda calculus dialect.
Variant fields are exposed for direct pattern matching; the AST is purely a data shape and carries no internal invariants beyond well- formedness produced by the parser.
Variants§
Var(VarName)
Variable reference.
Lam
Lambda abstraction: \param. body.
App
Function application: func arg (left-associative at the surface).
Fields
Let
Let-binding: let name = value in body.
Fields
Fix
Fixed-point binding: fix name. body, where name may refer to the
whole expression inside body. Models recursion without mutation.
Implementations§
Trait Implementations§
impl Eq for Expr
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnsafeUnpin for Expr
impl UnwindSafe for Expr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more