diff options
author | Bad Diode <bd@badd10de.dev> | 2021-10-31 11:15:16 +0100 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-10-31 11:15:16 +0100 |
commit | 3ed3aa338296f82046de2061e717b49328c8b057 (patch) | |
tree | ab7a90c367e54edc15f272618b4fafb0447446c0 /src/parser.h | |
parent | a31eff3926b4355ab9a4d7a76b0007fae0dd68b2 (diff) | |
download | bdl-3ed3aa338296f82046de2061e717b49328c8b057.tar.gz bdl-3ed3aa338296f82046de2061e717b49328c8b057.zip |
Ensure lambdas wrap their env tables
Diffstat (limited to 'src/parser.h')
-rwxr-xr-x | src/parser.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/parser.h b/src/parser.h index 01f53b0..fa8858e 100755 --- a/src/parser.h +++ b/src/parser.h | |||
@@ -4,6 +4,11 @@ | |||
4 | #include "lexer.h" | 4 | #include "lexer.h" |
5 | #include "hashtable.h" | 5 | #include "hashtable.h" |
6 | 6 | ||
7 | typedef struct Environment { | ||
8 | HashTable *table; | ||
9 | struct Environment *parent; | ||
10 | } Environment; | ||
11 | |||
7 | typedef enum ObjectType { | 12 | typedef enum ObjectType { |
8 | OBJ_TYPE_NIL, | 13 | OBJ_TYPE_NIL, |
9 | OBJ_TYPE_TRUE, | 14 | OBJ_TYPE_TRUE, |
@@ -38,6 +43,7 @@ typedef struct Object { | |||
38 | struct { | 43 | struct { |
39 | struct Object **params; | 44 | struct Object **params; |
40 | struct Object **body; | 45 | struct Object **body; |
46 | Environment *env; | ||
41 | }; | 47 | }; |
42 | 48 | ||
43 | // OBJ_TYPE_IF | 49 | // OBJ_TYPE_IF |
@@ -59,11 +65,6 @@ typedef struct Object { | |||
59 | size_t col; | 65 | size_t col; |
60 | } Object; | 66 | } Object; |
61 | 67 | ||
62 | typedef struct Environment { | ||
63 | HashTable *table; | ||
64 | struct Environment *parent; | ||
65 | } Environment; | ||
66 | |||
67 | typedef struct Parser { | 68 | typedef struct Parser { |
68 | Token *tokens; | 69 | Token *tokens; |
69 | size_t current; | 70 | size_t current; |