[][src]Struct rustws::Interpreter

pub struct Interpreter { /* fields omitted */ }

The interpreter used for running whitespace

Implementations

impl Interpreter[src]

pub fn new(code: String, print_instructions: bool) -> Interpreter[src]

Create an Interpreter from a source code passed as the argument

The print_instructions parameter prints the instructions. This should be set to True when debugging the code

Example

let source = String::from("   \t\t\n");
let interpreter = Interpreter::new(source, false);

pub fn from_file(file: &str, print_instructions: bool) -> Option<Interpreter>[src]

Initialize an interpreter from a file

The print_instructions parameter prints the instructions. This should be set to True when debugging the code

Example

let interpreter = Interpreter::from_file("main.ws", false);

pub fn write(&mut self, num: i32)[src]

Write a value on top of the stack Should be used when the Status is set to ReadChar/ReadInt

pub fn step(&mut self) -> Result<Status, Error>[src]

Step to the next instructions

See Status and Error for the return value

pub fn pc(&self) -> usize[src]

Current Program Counter

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.