Commit graph

9 commits

Author SHA1 Message Date
Alex Bethel b3866eea9e Fix panic on arithmetic error
Divide by zero and add, subtract, or multiply with overflow are all
caught now and reported as an ArithmeticError, rather than causing the
interpreter to panic.
2021-05-30 13:32:29 -05:00
Alex Bethel d13c22a473 More thorough unit tests 2021-05-30 13:32:29 -05:00
Alex Bethel 7bfefd3ba1 Add some unit tests to interpret.rs
Currently `overflow_should_not_panic` and `variable_persistence` both
fail due to bugs in the interpreter.
2021-05-30 13:32:29 -05:00
Alex Bethel 00e80e9740 Use single-letter identifiers as base-55 digits 2021-05-29 10:45:39 -05:00
Alex Bethel 51db37f1fe Improve name & documentation accuracy
Renamed ControlFlow -> HaltStatus because that's what the enum really
is -- a status on why something halted. Also reviewed `interpret.rs`'s
documentation and fixed a few things that were out of date.
2021-05-25 21:55:02 -05:00
Alexander Bethel 7537b4ac98 Implement break and hopback statements 2021-05-25 21:22:38 -05:00
Alexander Bethel e7560f9364 Better abstractions, implement scoping rules 2021-05-25 13:26:01 -05:00
Alexander Bethel 1c2032ab87 Implement more statements
Added variable declaration, `if` statements, `loop` statements,
variable assignment, and variable banning to go along with
printing (which was already implemented). We still need function
declarations, brainfuck declarations, function calls, and the control
flow operators "break" and "hopback".
2021-05-24 10:50:26 -05:00
Alexander Bethel e31b8fb00d Implement basic interpreter
Added code for interpreting parsed AbleScript expressions and
statements, and hooked it up to the REPL.
2021-05-20 18:18:01 -05:00