e152e40678
Errors - Refactoring
...
* This will break the whole thing but the error handling was getting
quite messy.
2023-01-03 22:17:11 +01:00
1346e0ccf0
Resolver - Return the map of resolved variables
2023-01-03 12:56:40 +01:00
376f28044c
Resolver - Fixed function handling
...
* Since the arguments are stored in an intermediate environment, an
additional scope is required
2023-01-03 12:55:48 +01:00
5a12ce44c1
Resolver - Initial implementation
...
* Not sure about using pointers to Expr nodes in order to remember how
they can be resolved.
* Unused and untested.
2023-01-03 08:50:12 +01:00
c8be65dc4c
Interpreter - Remove checks for duplicate argument names
2023-01-02 21:49:45 +01:00
29d3677b2a
Parser - Detect duplicate argument names
2023-01-02 21:49:16 +01:00
db781ed00f
HAPPY CLIPPY IS HAPPY!!!!
2023-01-02 21:44:02 +01:00
36c842d7ab
Parser - Cleaning up after field removal
2023-01-02 21:40:30 +01:00
46389d2962
AST - Removed field missed in previous changes
2023-01-02 21:38:33 +01:00
f1145bfbdf
Interpreter - Lambda support
2023-01-02 21:37:56 +01:00
0ef1318a35
Interpreter - Function name is optional (lambdas...)
2023-01-02 21:37:29 +01:00
ab46d0bcef
AST - Removed useless field from Lambda
2023-01-02 21:36:50 +01:00
2881eb5a61
Parser - Lambda functions
2023-01-02 21:24:59 +01:00
4769a2a7f3
AST - Lambda functions
2023-01-02 21:01:45 +01:00
783c10067b
Parser - Fixed parsing empty function parameters
2023-01-02 20:53:14 +01:00
12b2855fb1
Parser - Consume ';' after return statements
2023-01-02 20:48:38 +01:00
3dea0c9a45
Parser - Fixed can_use_return()
2023-01-02 20:47:12 +01:00
d6ea1c3099
Interpreter - Handle return value in functions
2023-01-02 20:46:34 +01:00
0de6b927b5
Interpreter - Return statement
2023-01-02 20:41:59 +01:00
3bd3c31210
Parser - Prevent return from being used outside of functions
2023-01-02 20:29:32 +01:00
0edabd4a48
Parser - Fixed loop parsing state in function bodies
2023-01-02 20:23:43 +01:00
549e93e9a9
Parser - Fixed comment
2023-01-02 20:21:52 +01:00
0290fbc226
Parser - Return statement
2023-01-02 20:20:47 +01:00
9b9103c170
AST - Added return statement
2023-01-02 20:16:14 +01:00
e4a86eb1de
AST - Fixed statement nodes with *Stmt names
2023-01-02 20:13:51 +01:00
6acf492aa2
Interpreter - Handle function definitions
2023-01-02 20:08:47 +01:00
cf3284cd88
Interpreter - Handle errors for multiple definitions of an argument
2023-01-02 20:08:05 +01:00
7b20ec2f3a
Interpreter - Define functions from name/params/body
...
* Used to be defined from statement, but this is cleaner and easier
2023-01-02 20:07:15 +01:00
c23ce47420
Parser - Fixed comment
2023-01-02 20:06:56 +01:00
5d1d3bd0a4
Parser - Fixed function call parsing
2023-01-02 20:06:36 +01:00
360ec57914
Interpreter - Fixed typo
2023-01-02 20:06:12 +01:00
8b74cd932d
Errors - Position for interpreter errors
2023-01-02 20:05:49 +01:00
ca3ec46bdc
Interpreter - Data structure for functions
2023-01-02 19:50:55 +01:00
f02d15fa83
Interpreter - Scope change for a few functions
2023-01-02 19:49:58 +01:00
e963a9f7ca
Interpreter - New submodule for functions
2023-01-02 18:58:20 +01:00
250eddea71
Parser - Parse function declarations
2023-01-02 18:57:25 +01:00
9c7445d904
AST - Added function to extract all block statements
2023-01-02 18:56:26 +01:00
cd731d387a
Parser - Renamed method
2023-01-02 18:33:20 +01:00
3738fb4f00
AST - Function declarations
2023-01-02 18:31:11 +01:00
0a38903154
I <3 CLIPPY
2023-01-02 18:23:12 +01:00
9d555acae0
Interpreter - Default environment includes native functions
2023-01-02 18:20:23 +01:00
24b57d35d0
Interpreter - clock() native function
2023-01-02 18:20:02 +01:00
7b8405119b
Interpreter - CallableRef type alias
2023-01-02 18:19:45 +01:00
d450f186b4
Interpreter - Added the native_fn empty mod
2023-01-02 17:57:34 +01:00
113fffb872
Interpreter - Environment::default() implemented manually
2023-01-02 17:55:05 +01:00
6a227c96ee
Interpreter - Fixed silly english/french confusion
2023-01-02 17:49:35 +01:00
3750b5226b
Interpreter - Check arity before calling
2023-01-02 17:47:53 +01:00
d47adab0f8
Interpreter - Call implementation
2023-01-02 17:45:56 +01:00
8ab144f3c5
Interpreter - Move function call arguments
2023-01-02 17:45:19 +01:00
1ad55e95f5
Interpreter - Use EnvironmentRef in Callable
2023-01-02 17:44:51 +01:00
34619a8125
Interpreter - Callable extends Debug and ToString
2023-01-02 17:40:06 +01:00
696a363ec6
Interpreter - Implement PartialEq manually for values
2023-01-02 17:39:31 +01:00
a4875ff876
Interpreter - Actually use the callable module
2023-01-02 16:04:44 +01:00
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
3a2e8eeda1
Parser - Variable assignment
2022-12-31 16:27:32 +01:00
b5ff24ffad
AST - Variable assignment
2022-12-31 16:16:12 +01:00
c486b81cba
Interpreter - Support for initializing and using variables
2022-12-31 16:13:40 +01:00
157c938395
AST - Store variable names as tokens in declarations
2022-12-31 16:06:20 +01:00
90557e6600
Interpreter - Create and pass the environment when evaluating
2022-12-31 16:01:47 +01:00
8b44af08ba
Interpreter - Initial environment implementation
2022-12-31 15:57:54 +01:00
7f94906412
Interpreter - Created environment module
2022-12-31 15:50:23 +01:00
bf6e150085
Interpreter - Split into multiple modules
2022-12-31 15:49:31 +01:00
81b5f27f0a
Interpreter - Moved module to subdirectory
2022-12-31 15:45:28 +01:00
d821331fa2
Parser - Variable references in expressions
2022-12-31 15:44:26 +01:00
a90b1529ad
AST - Added variable reference nodes
2022-12-31 15:42:10 +01:00
447e0fe623
Parser - Handle variable declarations
2022-12-31 15:39:52 +01:00
8e5a26bcc3
AST - Added variable declarations
2022-12-31 15:30:53 +01:00
c31a97eb76
Cargo features to control debugging output
2022-12-31 15:26:34 +01:00
14aef73d93
Interpreter - Run programs.
2022-12-31 15:19:41 +01:00
bf11a2b63a
Parser - Parse program as a list of statements
2022-12-31 14:45:55 +01:00
402e0a10d9
AST - Made statement nodes visible inside a program node
2022-12-31 14:45:35 +01:00
f17cafd910
AST - Program and basic statements
2022-12-31 14:36:01 +01:00
407fbe26b0
AST - Moved dumper trait out of the way
2022-12-31 14:27:20 +01:00
a69fea5538
Errors - ErrorHandler now includes info about the stage that failed
2022-12-31 14:00:23 +01:00
da50da4e08
CLIPPY IS THE MASTER OF ALL! (especially anal retentiveness)
2022-12-31 13:50:08 +01:00
b89e330423
Hooked up the interpreter
2022-12-31 13:49:01 +01:00
2aa9fb278a
Errors - Missing space in message
2022-12-31 13:48:00 +01:00
bc4541a50e
Interpreter - Initial implementation of the expression evaluator
2022-12-31 13:41:44 +01:00
25ae8b0c16
Errors - Interpreter error
2022-12-31 12:58:25 +01:00
58a986d280
Interpreter - Values
2022-12-31 12:50:44 +01:00
b5e9a1825a
Interpreter - Module created
2022-12-31 12:30:02 +01:00
7b66c35e16
Parser - Synchronize method
2022-12-31 12:27:51 +01:00
32dab4ad27
main - Fixed formatting
2022-12-31 10:22:22 +01:00
ffb1994a59
Main - expect(&format!()) is bad, according to clippy
2022-12-31 10:21:38 +01:00
0872f58baf
Tokens - Use the matches! macro for is_litteral()
2022-12-31 10:19:36 +01:00
980729ceb3
Tokens - Renamed EOF to Eof
2022-12-31 10:17:25 +01:00
e918d90e39
Scanner - Use is_ascii_digit() instead of is_digit(10)
2022-12-31 10:15:55 +01:00
45ed237818
Parser - Removed useless clone
2022-12-31 10:14:58 +01:00
c0bf521b61
AST - Removed unused import, reformatted.
2022-12-31 10:13:51 +01:00
1e122c77a5
Parser - Comments
2022-12-31 10:12:11 +01:00
fc345f2ffb
Parser - Parse expressions
2022-12-31 00:50:31 +01:00
faf50ea53e
AST - Use Token.is_litteral() when dumping
2022-12-31 00:50:04 +01:00
ccc6fe0320
Token - is_litteral() method
2022-12-31 00:49:54 +01:00
984ba5f600
Scanner - Reformatted
2022-12-31 00:29:38 +01:00
1fe96bdbf7
Errors - Parser error structure
2022-12-31 00:28:49 +01:00
aab0e0a591
Scanner - Add the EOF token
2022-12-31 00:02:41 +01:00
ed03d565ea
Parser - Created structure
2022-12-30 23:50:33 +01:00
8856d733ad
AST - Expression node + dumper trait
2022-12-30 23:50:02 +01:00
912c7a265e
Tokens - Stop complaining about EOF
2022-12-30 23:20:57 +01:00
c1025153d1
Scanner - Block comments w/ nesting
2022-12-30 20:19:00 +01:00
21778a745e
Scanner - Support for identifiers and keywords
2022-12-30 20:11:08 +01:00
3ccbcbc1c2
Scanner - Numbers
2022-12-30 19:10:14 +01:00
75dd3a2db2
Scanner - String litterals
2022-12-30 18:40:56 +01:00
4e9e566a4f
Main program - Reset REPL buffer before reading
2022-12-30 18:38:40 +01:00
6fad0fdfc4
Scanner - Slashes and whitespace
2022-12-30 18:28:36 +01:00
5af93af827
Scanner - Moved is_at_end()
2022-12-30 18:21:17 +01:00
8bdfbe59de
Scanner - 2-character operators
2022-12-30 18:20:45 +01:00
5747e02107
Scanner - Single-character lexemes
2022-12-30 18:13:52 +01:00
124ffd883f
Error handler in separate module + basic scanner module
2022-12-30 16:56:21 +01:00
987118be8b
Token-related definitions
2022-12-30 16:47:30 +01:00
7b8f15e072
Error state information
2022-12-30 16:33:34 +01:00
9d485a8c63
Either load a script or run the REPL
2022-12-30 16:17:46 +01:00
437d2fa4fe
Initial, empty project
2022-12-30 15:53:19 +01:00