[−][src]Struct iaith::brainf::Program
A container for all the state needed to execute a brainf*ck program.
Fields
program: Vec<Token>
A vector of tokens, representing the executable source code of the program
index: usize
A 'pointer' into the vector of tokens representing where in the code execution is currently happening.
tape: HashMap<i32, u8>
A map of cell number to value, representing the tape the program is manipulating
pointer: i32
A 'pointer' represnting which cell in the tape the program is currently manipulating.
state: State
Represents the state of the program's execution
Implementations
impl Program
[src]
pub fn new(source: &str) -> Program
[src]
Parse the given source code and construct an new instance of a program ready to be executed. Currently panics if the given source does not represent a valid program.
pub fn step(&mut self) -> Option<String>
[src]
Execute the next instruction in the program.
pub fn execute(&mut self) -> String
[src]
Execute the program, until it terminates.
Auto Trait Implementations
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnwindSafe for Program
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,