Module ketos::exec [] [src]

Implements a virtual machine which interprets bytecode functions.

The virtual machine consists of:

Bytecode instructions may modify or consume the value register, push values onto the stack, modify the instruction pointer, add a function call to the call stack, or return from the function currently being executed.

When a bytecode function is added to the stack, its stack pointer will be set to the position of the first argument which is passed to the function. It may load or modify these values. When the function returns, all values after the stack pointer will be automatically removed from the stack before returning control to the previous function execution. Every function returns a value, which is available to the calling function through the value register.

Structs

Context

Represents an execution context

Enums

ExecError

Represents an error generated while executing bytecode.

Functions

call_function

Calls a function or lambda in the given scope with the given arguments.

execute

Executes a code object and returns the value.

execute_function

Executes a Function in the given scope and returns the value.

execute_lambda

Executes a Lambda in the given scope and returns the value.

panic

Returns a Panic error with the given value.

panic_none

Returns a Panic error with no value.