HostInterface

Trait HostInterface 

Source
pub trait HostInterface {
    // Required methods
    fn initial_vars(&mut self) -> HashMap<String, Variable>;
    fn print(&mut self, string: &str, new_line: bool) -> Result<()>;
    fn read_byte(&mut self) -> Result<u8>;
    fn exit(&mut self, code: i32);
}
Expand description

Host Environment Interface

Required Methods§

Source

fn initial_vars(&mut self) -> HashMap<String, Variable>

Initial variables for a stack frame

Source

fn print(&mut self, string: &str, new_line: bool) -> Result<()>

Print a string

Source

fn read_byte(&mut self) -> Result<u8>

Read a byte

Source

fn exit(&mut self, code: i32)

This function should exit the program with specified code.

For cases where exit is not desired, just let the function return and interpreter will terminate with an error.

Implementors§