Closed nixpulvis closed 8 years ago
Worth noting, the ergonomics of Wrapping
are not great, but it is nice to see them explicitly.
I get this output when I try to run hello.b
mark macbook ~/c/l/r/brainfuck ((85c88d0...)) ❯ cargo run fixtures//hello.b
Running `target/debug/brainfuck fixtures//hello.b`
hXXX WWW
In testing these things it's key to play with and without the --release
flag. Also it'd be great to get a sense of what semantics we really want exactly. I'm pretty happy with having both the values and the pointer be wrapping numbers, but I can also see merit in bound checking the pointer explicitly.
Yea this is clearly not a working implementation ATM is it lol. Should add a test for whatever the fuck I broke. I was mostly avoiding writing tests that mock STDIN/STDOUT.
Rebased maser with new testing output of programs, and we're catching this bug now.
Now we just need to implement something like Wrapping
for wrapping to the size of the tape. Again, now the more I think about it the more I'm liking checking the pointer at runtime.
@mossberg do you have any thoughts on the best course of action for wrapping? I'm thinking about adding an error type for runtime errors and having one returned in these cases.
Merging this as it for now. Might look back at this later in another PR.
We want the values on the tape, and the value of the pointer to wrap in our language. Bound checking isn't something brainfuck should do IMO.