Struct timi::machine::Machine
[−]
[src]
pub struct Machine { pub stack: Stack, pub heap: Heap, pub globals: Environment, pub dump: Dump, pub options: MachineOptions, }
the core machine that runs our program.
Fields
stack: Stack
heap: Heap
globals: Environment
dump: Dump
options: MachineOptions
Methods
impl Machine
[src]
fn new_minimal() -> Machine
Create a minimal machine that has the prelude and primitives instantiated, but with an empty stack.
fn new_from_program(program: CoreProgram) -> Result<Machine, MachineError>
Create a machine from program
. Expects a main
to be present
in the given program.
Errors
returns an error if main
was not found
fn add_supercombinator(&mut self, sc_defn: SupercombDefn) -> Addr
Add the supercombinator to the machine.
This will allocate the supercombinator on the heap and create a binding in the environment to the name of the supercombinator.
Returns the address of allocation of the supercombinator
fn setup_supercombinator_execution(
&mut self,
sc_name: &str
) -> Result<(), MachineError>
&mut self,
sc_name: &str
) -> Result<(), MachineError>
setup the execution of a registered supercombinator with name sc_name.
fn is_final_state(&self) -> Result<bool, MachineError>
returns whether the machine is in final state or not.
Errors
Returns MachineError
if machine is in invalid state
fn step(&mut self) -> Result<(), MachineError>
inspect the top of the stack and take a step in interpretation if we are not in the final state
Trait Implementations
impl Clone for Machine
[src]
fn clone(&self) -> Machine
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more