Commit graph

9 commits

Author SHA1 Message Date
Alex Bethel 07195d4cf6 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 acfd81ead2 More thorough unit tests 2021-05-30 13:32:29 -05:00
Alex Bethel 344a11084e 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 585bf2e19f Use single-letter identifiers as base-55 digits 2021-05-29 10:45:39 -05:00
Alex Bethel c906366e3f 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 ec81ead3ea Implement break and hopback statements 2021-05-25 21:22:38 -05:00
Alexander Bethel 669f379700 Better abstractions, implement scoping rules 2021-05-25 13:26:01 -05:00
Alexander Bethel 109c77eeb2 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 eccc00ff81 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