Commit graph

18 commits

Author SHA1 Message Date
Alex Bethel 1a8f17339e Reimplement BF function declaration semantics 2021-06-12 09:26:21 -05:00
Alex Bethel dfededfe26 Fix all 0..0 span placeholders in interpret.rs 2021-06-07 19:57:44 -05:00
Alex Bethel 3bca3f88a6 Repair interpreter after parser changes 2021-06-07 16:20:20 -05:00
Erin 7b1546387e Unified span terminology
- Add more derivations, because it's required by another parts of project
2021-06-07 22:21:21 +02:00
Alex Bethel d80f47716d Use impl Value rather than trait BfWriter
It probably makes more sense to be writing values with
`Value::bf_write` than to go for the complexity of using a trait to
allow `Writer::write_value` (which also looks ambiguous because it's
not immediately clear that a generic name like "write_value" relates
to BF or AbleScript).
2021-06-02 18:20:30 -05:00
Alex Bethel 2c35691ec4 Add Brainfuck functio interpretation
BF functios can now be declared and called from AbleScript code.
Function parameters supplied from AbleScript are serialized manually
into byte sequences using the `BfWriter` trait, and are available from
BF code using the input operator, `,`.

At the moment, BF functios simply write output to stdout, and are
therefore incapable of communicating results to the rest of the
program; this might change in the future if we can get something close
to pass-by-reference working.
2021-06-02 15:29:31 -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 e79fc9a005 Allow abool -> bool coercion
The expression `sometimes & true` now evaluates to `true` 50% of the
time and false 50% of the time, rather than throwing a type error
because `sometimes` is not a bool.
2021-05-21 12:25:37 -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
able f98c4d83d9 Minor Changes 2021-05-03 19:33:21 -05:00
Erin d80b5514ce Added tests and loop flow 2021-05-02 18:12:51 +02:00
Erin f8db60bc7c Added T-Dark block
- obeyed clippy
2021-05-02 17:38:12 +02:00
Erin 5c00446c59 Implemented function calls 2021-04-29 18:50:51 +02:00
Erin 00a464321a Added parsing of conditionals 2021-04-27 13:48:56 +02:00
Erin fc8c3a3499 Made parser to throw error when unexpected EOF 2021-04-27 11:57:11 +02:00
Erin f7d1287fd5 Implemented abool
- Tidied up code
2021-04-18 23:40:41 +02:00
Erin 7026711b64 Initial parser work 2021-04-18 16:39:43 +02:00
able 08af75fbda variable things added 2021-04-13 18:01:19 -05:00