06917ca2d6
Resolver - Split resolve_local() into specific methods
2023-01-07 11:06:22 +01:00
24d9d6d880
Resolver - Handle the global namespace as well
2023-01-07 10:58:02 +01:00
c971df6f60
Resolver - Refactored declare()
2023-01-07 10:53:05 +01:00
8d65c288a3
Resolver - Refactored entering/exiting scopes
2023-01-07 10:51:34 +01:00
6dceae73a0
Resolver - Additional checks
...
* Ensure all locals are defined before they are used.
* Prevent functions declared using fun from being assigned to.
* Mark locals as used when they are accessed.
2023-01-07 10:17:08 +01:00
a89be8632c
Missed a rename in previous commit
2023-01-07 09:17:02 +01:00
95ddd34f9c
Interpreter - Renamed resolved variables field
2023-01-07 09:01:24 +01:00
363cdab86f
Interpreter - Fixed closures
...
* Environment for function execution is now based on their
declaration.
* I had missed that part while skimming over the book.
2023-01-07 08:59:13 +01:00
ec70ded29e
Fixed variable lookups and assignments
2023-01-07 08:48:21 +01:00
3117dfeac5
Interpreter - Lookups and assignment based on resolver results
...
* Does not work. Using pointers was a bad idea.
2023-01-07 08:24:27 +01:00
bd156e619f
Trying to implement variable lookup and failing hard
...
* I'll probably have to rewrite environments as a Vec<HashMap> to make
things simpler
2023-01-06 08:05:33 +01:00
c97ad0ad7e
Interpreter - Made the interpreter state partially public
...
* This allows Callable to be public, which is required for Value
* State internals are still hidden behind pub(super)
2023-01-06 07:47:45 +01:00
10223cbb4e
Interpreter - WIP refactor to prepare for using resolved variables
2023-01-05 07:54:18 +01:00
d528ce8dc3
Interpreter - Limited scope of some declarations
2023-01-05 07:21:43 +01:00
754659ed12
Resolver - Removed invalid fix mistakenly committed in 79a0667
2023-01-05 07:13:20 +01:00
c90731b62d
Resolver - Comments
2023-01-05 07:12:21 +01:00
64bc8312dd
Resolver - resolve_function() shouldn't be a method from ResolverState
2023-01-05 07:09:35 +01:00
b5573cee3b
Resolver - Fixed off-by-one error in resolve_local()
2023-01-05 07:06:27 +01:00
79a0667f34
Resolver - Errors on duplicate declarations
2023-01-05 06:58:29 +01:00
c1a61b992d
Scanner - Style clean-up
2023-01-05 06:43:54 +01:00
c5f099340b
Errors refactoring - Code compiles.
2023-01-04 07:58:44 +01:00
743379c516
Errors refactoring for the iterpreter
2023-01-04 07:49:28 +01:00
7961a92ad1
Further attempts at refactoring the error handling code
...
* Everything's still broken though
2023-01-04 07:35:40 +01:00
0443754007
Parser - Refactored error handling
2023-01-03 23:07:49 +01:00
acb29e7123
Resolver - Refactored error handling
2023-01-03 22:50:47 +01:00
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