interpret

Function interpret 

Source
pub fn interpret<I, E, O>(
    mem: &mut Vec<u8>,
    program: &[u8],
    input: I,
    output: O,
    eof_retry: bool,
) -> Result<(), (TapirError<E>, usize)>
where I: IntoIterator<Item = Result<u8, E>>, O: Write,
Expand description

Runs a Brainfuck program to completion, or produces an error in the form of a TapirError along with the index into program of the last instruction executed.

§Arguments

  • mem - A buffer to use as the memory tape
  • program - Brainfuck program text as bytes
  • input - An iterator over bytes of “user” input, read when interpret encounters a , instruction
  • output - A Writeable sink for program output, written to when interpret encounters a . instruction
  • eof_retry - Whether to repeatedly call next when reading input fails, i.e. when input.into_iter().next() returns None