Commit graph

160 commits

Author SHA1 Message Date
3b5778ff47 Interpreter - Function re-ordering 2023-01-02 16:00:10 +01:00
b1d0db5ea4 Interpreter - Callable interface definition 2023-01-02 15:54:50 +01:00
fecea3b388 Parser - Support for calls with arbitrary expressions as the callee 2023-01-02 15:32:33 +01:00
4c55e9e784 AST - Function calls modified to match the book's 2023-01-02 15:23:33 +01:00
312cdf18d5 Parser - Maximum argument count for functions 2023-01-02 15:18:02 +01:00
acbce309fa Parser - Support for function calls 2023-01-02 15:15:34 +01:00
2e7a897c47 AST - Function call expression node 2023-01-02 15:05:41 +01:00
a317e54426 CLIPPY IS GOD. 2023-01-02 14:10:32 +01:00
2f0798bfe1 Interpreter - Implemented new version of the loop statement 2023-01-02 12:18:00 +01:00
4c54643a8d Parser - Use new loop AST node 2023-01-02 12:10:37 +01:00
c407fcd546 Parser - Improved recovery after break/continue w/ unknown label 2023-01-02 12:07:10 +01:00
ca76b3ab3f AST - Changed loop representation 2023-01-02 12:06:37 +01:00
06ae3dd973 Parser - Fixed named loop finder. 2023-01-02 12:00:46 +01:00
7541a8bda6 Interpreter - Support for loop labels 2023-01-02 11:26:12 +01:00
2599c0ebdc Interpreter - Don't return interpreter results from the environment's methods 2023-01-02 11:25:48 +01:00
14d5b94f76 AST - Fixed loop label dump 2023-01-02 11:25:18 +01:00
c5c8b04355 Parser - Removed unused code 2023-01-02 11:25:02 +01:00
c36654fb7e Parser - Labelled loops 2023-01-02 10:44:37 +01:00
2f44a81b6d AST - Added labels to while statements 2023-01-02 10:37:47 +01:00
bf8eee7ecb Parser - Loop control statements
* Store a loop parsing state when entering a loop. The parser uses
    this to cause an error when break/continue are found outside a loop.
  * Parse break and continue statements w/ optional identifier
2023-01-02 10:25:48 +01:00
f3b2552679 Tokens - Address ('@') token for loop labels 2023-01-02 10:00:05 +01:00
48b86d5087 AST - Break/Continue with label 2023-01-02 09:57:42 +01:00
154d072ca8 AST - Break and continue 2023-01-01 19:55:30 +01:00
a403799d22 Scanner - break + continue keywords 2023-01-01 19:52:02 +01:00
f8f9d376fb Tokens - Break + Continue 2023-01-01 19:51:10 +01:00
b9e659350b Parser - Re-use for loop body if it's a block and an incr statement is needed 2023-01-01 19:47:04 +01:00
f95fcc4e3e Parser - Initial implementation of the for loop 2023-01-01 19:41:02 +01:00
14bff1d7bc AST - Fixed block dump 2023-01-01 19:40:47 +01:00
d8888fd15f Parser - Re-added parens around if / while conditions
Mostly because lox's for loop is C-like and would feel weird without
parens.
2023-01-01 19:04:37 +01:00
ddf6625326 Interpreter - While loops 2023-01-01 18:44:35 +01:00
daec88c2f8 Parser - While loops 2023-01-01 18:40:05 +01:00
529a588900 AST - While loops 2023-01-01 18:33:45 +01:00
a671836655 Interpreter - Support for logical or / and 2023-01-01 18:27:45 +01:00
79c594afa9 Interpreter - Fixed == operator. Oops. 2023-01-01 18:27:33 +01:00
5db3caab61 Parser - Fixed comments 2023-01-01 18:13:32 +01:00
2e0e3f9ef0 Parser - Support for and / or 2023-01-01 11:18:08 +01:00
0637e52c83 AST - Logical binary expressions 2023-01-01 11:13:41 +01:00
9a84283245 Interpreter - If statement 2023-01-01 11:10:48 +01:00
8711fde112 Parser - Support for if statement
* Different from the book's implemenation as it doesn't use additional parens
2023-01-01 11:04:32 +01:00
2eda13de38 AST - Conditional statement added 2023-01-01 10:58:45 +01:00
81aef09c5b Interpreter - Additional errors for variables
* Uninitialized variable usage
  * Redefining variables
2023-01-01 10:52:29 +01:00
e92628a4eb Interpreter - Nested environments 2022-12-31 17:27:09 +01:00
d9e3ef2623 Environment - Rc<RefCell<...>> to store the parent 2022-12-31 17:26:40 +01:00
7d22b15854 Parser - Support for blocks 2022-12-31 17:05:58 +01:00
3fe2b4256a AST - Blocks 2022-12-31 16:58:48 +01:00
c71bdd8c87 Environment - Attempt at nesting support 2022-12-31 16:56:00 +01:00
71ddef17d8 Parser - Fixed error recovery 2022-12-31 16:42:32 +01:00
5efc90e89b Parser - Error recovery 2022-12-31 16:40:59 +01:00
f4111577ca Interpreter - Variable assignment 2022-12-31 16:36:29 +01:00
8d6191c7ee Environment - Support for assignment 2022-12-31 16:32:59 +01:00