Closed maw3193 closed 1 year ago
It might be more convenient for me to also implement a DecoratedProgram::from_file
, but that'll need some more thought, because it could have an IOError, or a ParseError.
I think I've avoided needing to write a From impl for converting from a std::io::Error to a VMError, this might be because thiserror can automatically implement From when an error's Source is specified.
Continuing the bft project, this time we're making the interpreter do things!
new()
.impl CellKind for u8
set_value()
method that takes a u8.read_value()
reads a byte from stdin (note: brainfuck is always bytes, even if larger values can be stored in cells)std::io::Error
toVMError
. This might be tricky, the important part is being able to use the?
operator on anything that returns aResult<_,VMError>
.std::io::Cursor<Vec<u8>>
to get around need for stdin and stdout.[
and]
instructions.