pub trait GeneralInterpreter {
type Value: Clone + ValueTrait + Debug;
// Required methods
fn interpret_expr(
&mut self,
ctx: &mut Context<Self::Value>,
expr: ExprNodeId,
) -> Self::Value;
fn get_empty_val(&self) -> Self::Value;
// Provided methods
fn deref_store(&self, val: &Self::Value) -> Self::Value { ... }
fn wrap_store(&self, val: Self::Value) -> Self::Value { ... }
fn eval_in_new_env(
&mut self,
binds: &[(Symbol, Self::Value)],
ctx: &mut Context<Self::Value>,
e: ExprNodeId,
) -> Self::Value { ... }
fn eval_with_closure_env(
&mut self,
binds: &[(Symbol, (Self::Value, TypeNodeId))],
ctx: Context<Self::Value>,
e: ExprNodeId,
) -> Self::Value { ... }
fn eval(
&mut self,
ctx: &mut Context<Self::Value>,
expr: ExprNodeId,
) -> Self::Value { ... }
}Expand description
Trait for defining general reduction rules of Lambda calculus, independent of the primitive types, even if it is untyped.
Required Associated Types§
type Value: Clone + ValueTrait + Debug
Required Methods§
fn interpret_expr( &mut self, ctx: &mut Context<Self::Value>, expr: ExprNodeId, ) -> Self::Value
fn get_empty_val(&self) -> Self::Value
Provided Methods§
Sourcefn deref_store(&self, val: &Self::Value) -> Self::Value
fn deref_store(&self, val: &Self::Value) -> Self::Value
Helper method to dereference Store values. Override this for types that support Store.
Sourcefn wrap_store(&self, val: Self::Value) -> Self::Value
fn wrap_store(&self, val: Self::Value) -> Self::Value
Helper method to wrap values in Store. Override this for types that support Store.