proper lexical scoping now woo

This commit is contained in:
Lobo 2026-01-14 12:10:29 -03:00
parent ce9489b5d2
commit 27df5f8ce0
13 changed files with 349 additions and 45 deletions

View file

@ -176,16 +176,20 @@ enum {
OP_GET_LOCAL,
OP_SET_LOCAL,
OP_RESERVE,
OP_DUP,
};
// Local variable info
typedef struct Lv {
O name;
U16 index;
I escapes;
} Lv;
// Compiler context
typedef struct Cm {
typedef struct Cm Cm;
struct Cm {
Cm *parent;
In *in;
U8 *code;
Z count;
@ -202,6 +206,8 @@ typedef struct Cm {
O mac;
O progn;
O def;
O and;
O or;
} specials;
struct {
Lv *data;
@ -209,7 +215,7 @@ typedef struct Cm {
Z capacity;
} locals;
I use_locals;
} Cm;
};
enum {
TOK_EOF = 0,