Ignoring the unimplemented opcodes, I believe you got the memory pointer backwards.
Currently, you index memory on the singular value cell, and never actually access memory for other operations (here, the naïve looping implementation).
How does the interpreter look like now:
memory = [0u8; 256]; value = 0;+, - => memory[value] = memory[value] +- 1,
>, < => value = value +- 1,
[ => if value != 0 { continue; } else { /* Complex forwards scan */ },
] => if value == 0 { continue; } else { /* Complex backwards scan */ }
Ignoring the unimplemented opcodes, I believe you got the memory pointer backwards.
Currently, you index memory on the singular value cell, and never actually access memory for other operations (here, the naïve looping implementation).
How does the interpreter look like now:
memory = [0u8; 256]; value = 0;
+
,-
=>memory[value] = memory[value] +- 1
,>
,<
=>value = value +- 1
,[
=>if value != 0 { continue; } else { /* Complex forwards scan */ }
,]
=>if value == 0 { continue; } else { /* Complex backwards scan */ }
How it should look like:
memory = Vec<u8>::new(); ptr = 0
+
,-
=>memory[ptr] = memory[ptr] +- 1
,>
,<
=>ptr = ptr +- 1
[And handle Vec resizing],[
=>if memory[ptr] != 0 { continue; } else { /* Complex forwards scan */ }
,]
=>if memory[ptr] == 0 { continue; } else { /* Complex backwards scan */ }