Commit graph

273 commits

Author SHA1 Message Date
HTG-YT f9f891cd20 add StmtKind::Rickroll 2021-06-13 13:11:51 +08:00
HTG-YT 3ffdd15b41 add rickroll lexeme in lexer 2021-06-13 13:11:02 +08:00
Alex Bethel ede6eccc71 Make arithmetic errors evaluate to 42 2021-06-12 10:48:44 -05:00
Alex Bethel 083eb01282 Integrate const.rs as consts 2021-06-12 10:45:25 -05:00
Alex Bethel 1a8f17339e Reimplement BF function declaration semantics 2021-06-12 09:26:21 -05:00
Erin ae3a7b7c8a Better comment 2021-06-11 19:44:53 +02:00
Erin 76e5fb9043 Removed todo when unknown token 2021-06-11 18:34:34 +02:00
Erin 8dbf93caa5 Fixed invalid spanning of UnexpectedToken in parse_expr 2021-06-11 18:31:25 +02:00
Erin f3c459f26e BF code is now Vec<u8> 2021-06-11 18:10:11 +02:00
Erin eecde7635c Basic BfFunctio support 2021-06-11 17:52:47 +02:00
Alex Bethel 2a428e8415 Re-enable assignment semantics 2021-06-11 10:05:48 -05:00
Erin 588f69b710 Added variable assignment to parser
- Fixed parse error, that `rlyeh` returned HopBack
2021-06-11 16:59:40 +02:00
ondra05 0046149c0d Merge pull request #29 from HTG-YT/interpreter-fixes
add `interessant`, `nevergonnagiveyouup` and `funny` constants
2021-06-11 09:33:48 +02:00
HTG-YT 6a6658fd75 add nevergonnagiveyouup constant 2021-06-11 15:26:30 +08:00
HTG-YT 6d7fbb3514 add interessant and funny constants 2021-06-11 15:19:27 +08:00
Alex Bethel 0fe7819e28 Fix interpreter variable persistence bug 2021-06-08 19:21:33 -05:00
Alex Bethel 39c5709db7 Better error handling in REPL
We have much better spanned expression support, so now we get to show
it off!
2021-06-07 20:08:38 -05:00
Alex Bethel bdb32c4599 Remove 0..0 placeholder from unexpected_eof() 2021-06-07 20:03:26 -05:00
Alex Bethel dfededfe26 Fix all 0..0 span placeholders in interpret.rs 2021-06-07 19:57:44 -05:00
Alex Bethel b6a4ecba29 Fix unit tests 2021-06-07 17:35:49 -05:00
Alex Bethel aedeeb2512 Remove giant comment block left in by mistake 2021-06-07 16:28:27 -05:00
Alex Bethel 3bca3f88a6 Repair interpreter after parser changes 2021-06-07 16:20:20 -05:00
Erin 717d592710 Added T-Dark test 2021-06-07 23:06:13 +02:00
Erin 84f58dab3d Added tests, Bugfix
- Originally, it spanned from operator (bug)
2021-06-07 22:58:28 +02:00
Erin 99ebd71dac Added missing mut 2021-06-07 22:24:43 +02: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
Erin beffef80c6 Changed position terminology 2021-06-07 21:28:24 +02:00
Erin 17a7f33c0b Removed unwraps, added Rlyeh 2021-06-07 11:07:50 +02:00
Erin 42df59705b Implement function calls
- And printing
- Revised terminology in Lexer
- Control flow
2021-06-07 11:00:06 +02:00
Erin f0cd6cd0ad Added logical operators 2021-06-07 09:17:30 +02:00
Erin 927ad5e955 Binary operator boilerplate reduction 2021-06-07 09:17:18 +02:00
Erin afee5fb82d Added basic parsing
- Expressions
- If, Functio
2021-06-07 00:09:45 +02:00
Erin d66874624b Initial chthulic error impl in Lexer
- See discussions #17
2021-06-06 23:15:11 +02:00
Erin b9d10fae03 AST revamp
- Unified terminology of span in error.rs
2021-06-06 23:13:48 +02:00
Erin e5c6feacb9 Updated AST 2021-06-06 21:09:18 +02:00
Erin bccf5bc74b Removed custom Lexer, reorganised Token definition
- As peeking will not be involved in parsing, it was removed
2021-06-06 20:28:13 +02:00
Erin 935ba3b791 Deleted old parser 2021-06-06 20:05:18 +02:00
Alex Bethel 08b4fff20d Correct spelling of "occurred" 2021-06-05 08:50:20 -05:00
Alex Bethel 2cb915dd24 Prettier error handling 2021-06-04 18:56:26 -05:00
Able 723719b9df Merge pull request #28 from AlexBethel/bf-functio 2021-06-02 20:02:53 -05:00
Alex Bethel 98b2fae6f3 Clean up eval_expr some more
I keep going back and forth on how I want this block to look :P
Anyway, this is *probably* its final-ish form, until the parser gets
re-written.
2021-06-02 18:41:20 -05: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
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
Able 3e94e9e78c Merge pull request #27 from AlexBethel/master 2021-05-29 17:14:25 -05:00
Alex Bethel fcfa83a8a6 Make base-55 encoding & decoding match
Changed "U"'s encoding to -210, so now when the README claims "U =
-210", it's actually accurate :)
2021-05-29 14:24:46 -05:00
Alex Bethel 00e80e9740 Use single-letter identifiers as base-55 digits 2021-05-29 10:45:39 -05:00
Able cedc52024c Merge pull request #26 from Seppel3210/patch-1 2021-05-28 05:10:43 -05:00