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
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
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
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
Able
b37c189da9
Slightly more curse
2021-05-24 01:18:36 -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
464337bd53
Make ablescript -f
run interpreter
...
`ablescript -f foo.able` will now both parse and interpret `foo.able`,
rather than just parsing it.
2021-05-20 18:24:18 -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
tdark
1306c797c8
Added support for specifying a tape size limit
2021-05-15 18:39:49 +02:00
tdark
99758a177b
Implemented brainfuck interpreter
2021-05-15 18:10:50 +02:00
able
fafe6cf672
consider using able brand products
2021-05-05 07:33:40 -05:00
able
ac88a2e3c6
Brain fuck work
2021-05-04 22:23:17 -05:00
able
f98c4d83d9
Minor Changes
2021-05-03 19:33:21 -05:00
Erin
1618262948
Tidy up
2021-05-03 23:02:19 +02:00
Erin
5bdbc2bbb0
Obeyed our paperclip overlord + fmt
2021-05-03 21:36:32 +02:00
Erin
7057c3cfef
Fixed some incompatible old code
...
- Added assignment support
- Reduced boilerplate
- Removed `else`
2021-05-03 21:35:43 +02:00
Erin
c0ecf5f2a3
Variable assignment implemented
2021-05-03 09:54:27 +02:00
Erin
4b2d306ccb
Fixed #13
2021-05-03 08:47:52 +02: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
ecd972e55d
Parser production ready
...
- TODO: T-Dark block
- cargo fmt
- Obeyed our clippy overlord
2021-05-02 16:48:33 +02:00
Erin
4a9b656093
Parser implements examples
...
- Function call is now stmt (muhehe)
2021-05-02 15:43:25 +02:00
Erin
91bd015e9b
Added basic math operations
...
- cargo fmt
2021-05-02 00:39:08 +02:00
Erin
d7cf1b013d
Divided token types
...
- Item = Expr | Stmt
- Added REPL (AST dump)
- Removed operator parsing because it was horrible and I need to redo it
2021-05-01 13:44:58 +02:00
Erin
c26c4a14bb
Tidy up
2021-04-29 19:19:35 +02:00
Erin
5c00446c59
Implemented function calls
2021-04-29 18:50:51 +02:00
Erin
27a8de70fa
Bugfix: Peeking
...
- Fixed `PeekableLexer` next to not-be passtrough to iterator
- Made error handling depend on state of Option
2021-04-29 09:47:29 +02:00
Erin
3e019621b2
Added Peekable Lexer
...
- Added wrapper for Lexer with `peek()` method
- Renamed `token` module to `lexer` as it more describe it's function
- Started work on operator flow
2021-04-28 22:52:19 +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
2a0b2952d4
Redone original parser
...
= implemented original features
2021-04-27 11:49:07 +02:00
Erin
138b9efadc
Added testing for base55, new identifier lexing
2021-04-27 11:09:19 +02:00
Erin
83c549607c
Continue work on parser, improved lexer
...
- Added literal parsing (improved lexing)
- Revised error handling
2021-04-27 10:51:39 +02:00
Erin
47400ee2ce
Starting work on parser improvements
...
- Parser should parse single expressions
2021-04-26 10:44:42 +02:00
Erin
f7d1287fd5
Implemented abool
...
- Tidied up code
2021-04-18 23:40:41 +02:00
Erin
3e2dc5fba9
Added function/variable parsing
...
- Added block support
- TODO: Tidy it up
2021-04-18 22:33:55 +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
Erin
4ca017671c
clippy + fmt
2021-04-13 17:43:54 +02:00
Erin
406c6b1297
Improved Scanner
2021-04-13 17:40:20 +02:00
Erin
2194e2726f
Added tokenization
...
- Added tokenization
- Modified `Token` definition for make it compatible with Logos
- And also obeyed our paperclip overlord and changed all names to be complaint with Rust conventions
2021-04-12 20:20:45 +02:00
able
00cca9fc74
Merge branch 'master' of https://github.com/AbleTheAbove/able-lang
...
merge
2021-04-11 22:40:32 -05:00
able
607b51c6cb
abbolean change
2021-04-11 21:47:10 -05:00
ondra05
b062b9a216
Add ANSWER const
2021-04-12 01:02:08 +02:00
able
2c4154025f
Tokens added or something
2021-04-11 17:22:06 -05:00
able
6719d955e8
Worst best parser
2021-04-11 15:11:23 -05:00
able
abd2d7e5f8
more fixes
2021-04-11 14:18:41 -05:00
able
b96bba96de
damn ablelang
2021-04-11 14:11:39 -05:00
able
c81fa06641
License and constants added
2021-04-11 13:22:59 -05:00
able
18354befd1
More representative of base_55 as it should be
2021-04-11 11:59:26 -05:00
able
1e701f73ab
added base 55
2021-04-11 11:47:35 -05:00
able
cc66d0b63a
AbleLang is coming together boys :) and girls and enby pals
2021-04-08 16:11:20 -05:00