pub fn run_program_str(
    program: &str,
    input: impl Read,
    output: impl Write
) -> Result<(), Error>
Expand description

Parses and run the commands contained in the given string using the provided input and output. Each command has to be on its own line.

// load program from file
let mut file = File::open("example.pancake").unwrap();
let mut program_str = String::new();
file.read_to_string(&mut program_str).unwrap();

// parse the program
let program = pancakestack::parse_program_str(&program_str);

// run the program
pancakestack::run_program(&program, std::io::stdin(), std::io::stdout()).unwrap();

Errors

Will return Err if the given program performs an illegal operation or an io error occurs. See Error.