Commit graph

319 commits

Author SHA1 Message Date
36ac55d286 Errors - ErrorKind to program exit code 2023-01-03 22:44:48 +01:00
a59dc21223 Errors - Result subtype using SloxError 2023-01-03 22:40:36 +01:00
d3398e5f79 Errors - Added ErrorKind::Scan 2023-01-03 22:40:24 +01:00
d0d4038272 Errors - ErrorHandler.report() consumes the error 2023-01-03 22:40:01 +01:00
260b19030f Scanner - Refactored to use new error handling 2023-01-03 22:38:57 +01:00
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
a65bb4aa73 Cargo manifest - Added dependency on itertools 2023-01-02 19:49:27 +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