pub struct Interpreter {
pub global_env: Rc<Env>,
pub ctx: EvalContext,
}Expand description
The interpreter holds the global environment and state.
Fields§
§global_env: Rc<Env>§ctx: EvalContextImplementations§
Source§impl Interpreter
impl Interpreter
pub fn new() -> Self
pub fn new_with_sandbox(sandbox: &Sandbox) -> Self
Sourcepub fn eval(&self, expr: &Value) -> EvalResult
pub fn eval(&self, expr: &Value) -> EvalResult
Evaluate a single expression on the VM. M6: the VM is the sole evaluator.
NOTE (deliberate behavior change vs. the retired tree-walker): all eval
entry points now run in the global env, so top-level defines persist
across calls. The old eval/eval_str child-env isolation is gone —
maintaining two env semantics was the dual-evaluator complexity being
removed. Use a fresh Interpreter for an isolated evaluation.
Sourcepub fn eval_str(&self, input: &str) -> EvalResult
pub fn eval_str(&self, input: &str) -> EvalResult
Parse and evaluate on the VM (global env; defines persist — see eval).
Sourcepub fn eval_in_global(&self, expr: &Value) -> EvalResult
pub fn eval_in_global(&self, expr: &Value) -> EvalResult
Evaluate in the global environment so that define persists across calls.
Sourcepub fn eval_str_in_global(&self, input: &str) -> EvalResult
pub fn eval_str_in_global(&self, input: &str) -> EvalResult
Parse and evaluate in the global environment so that define persists across calls.
Sourcepub fn eval_str_compiled(&self, input: &str) -> EvalResult
pub fn eval_str_compiled(&self, input: &str) -> EvalResult
Parse, compile to bytecode, and execute via the VM (global env, persists).
Sourcepub fn compile_to_bytecode(
&self,
input: &str,
) -> Result<CompileResult, SemaError>
pub fn compile_to_bytecode( &self, input: &str, ) -> Result<CompileResult, SemaError>
Compile source code to bytecode without executing. Handles macro expansion (defmacro + macro calls) before compilation.
Sourcepub fn expand_for_vm(&self, expr: &Value) -> EvalResult
pub fn expand_for_vm(&self, expr: &Value) -> EvalResult
Pre-process a top-level expression for VM compilation: register any
defmacro forms, then expand macro calls in all other forms.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Interpreter
impl !RefUnwindSafe for Interpreter
impl !Send for Interpreter
impl !Sync for Interpreter
impl !UnwindSafe for Interpreter
impl Unpin for Interpreter
impl UnsafeUnpin for Interpreter
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request