pub enum Instruction {
PushConst(UnsafeVal),
PushCurrentFunction,
Pop(usize),
GetArg(usize),
BindArg(usize),
Deref(Symbol),
Define(Symbol),
Eval(usize),
EvalNative {
func: NativeFunction,
arg_count: usize,
},
JumpIf(usize),
Jump(usize),
Return,
}Expand description
An instruction for the VM to execute.
Variants§
PushConst(UnsafeVal)
Push a constant onto the stack.
PushCurrentFunction
Push the current function onto the stack.
Pop(usize)
Pop the top n elements in the stack.
GetArg(usize)
Get the nth argument from the start of the continuation’s stack.
BindArg(usize)
Bind the top argument to the nth argument in the stack.
Deref(Symbol)
Get the value of a symbol at push it onto the stack.
Define(Symbol)
Pop the top value of the stack and assign it to the given symbol.
Eval(usize)
Pop the top n values of the stack. The deepmost value should be function with the rest of
the values acting as the arguments.
EvalNative
Pop the top n values of the stack. The deepmost value should be function with the rest of
the values acting as the arguments.
JumpIf(usize)
Pop the top value of the stack. If it is true, then jump n instructions.
Jump(usize)
Jump n instructions.
Return
Return from the current function.
Trait Implementations§
Source§impl Clone for Instruction
impl Clone for Instruction
Source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more