[][src]Struct bfkit::interp::Interpreter

pub struct Interpreter { /* fields omitted */ }

A Brainfuck interpreter that supports breakpoints.

Methods

impl Interpreter[src]

pub fn new(code: Vec<BrainfuckInstruction>) -> Self[src]

Creates a new Interpreter form some input program.

Arguments

  • code - A sequence of BrainfuckInstructions to be interpreted.

pub fn set_breakpoint(&mut self, address: usize) -> Result<bool, String>[src]

Sets a breakpoint at the specified code address.

Arguments

  • address - The code address to set a breakpoint at.

pub fn delete_breakpoint(&mut self, address: usize) -> bool[src]

Removes a breakpoint at the specified code address.

Arguments

  • address - The code address to delete a breakpoint from.

pub fn run(&mut self) -> StopReason[src]

Runs the Interpreter until either a breakpoint is hit or until the program has run to completion.

pub fn step(&mut self)[src]

Executes a single BrainfuckInstruction.

pub fn get(&self, address: usize) -> Result<u8, String>[src]

Reads a value from the tape at the specified address.

Arguments

  • address - The tape address to read.

pub fn set(&mut self, address: usize, value: u8) -> Result<u8, String>[src]

Writes a value to the tape at the specified address.

Arguments

  • address - The tape address to write to.
  • value - The value to write.

pub fn jump(&mut self, address: usize) -> Result<(), String>[src]

Sets the instruction pointer to the specified code address.

Arguments

  • address - The code address to jump to.

pub fn select(&mut self, address: usize) -> Result<(), String>[src]

Sets the data pointer to the specified tape address.

Arguments

  • address - The tape address to set the data pointer to.

Auto Trait Implementations

impl Send for Interpreter

impl Sync for Interpreter

Blanket Implementations

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.

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

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

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