From e9b99a90510309ac4f5d91d4a5138e7a84904057 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Mon, 24 Jun 2024 20:20:06 +0100 Subject: add local variables and (let) form --- dis.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'dis.c') diff --git a/dis.c b/dis.c index 0b1d322..6827be0 100644 --- a/dis.c +++ b/dis.c @@ -39,6 +39,11 @@ static size_t disasm_instr_h(Chunk *ch, size_t ip, int depth) { print_const(ch, ix); break; } + case OP_GETLOCAL: { + uint8_t ix = ch->bc.d[ip++]; + printf("getlocal #%d\n",ix); + break; + } case OP_SETGLOBAL: { uint8_t ix = ch->bc.d[ip++]; printf("setglobal #%d\t; ",ix); @@ -50,6 +55,11 @@ static size_t disasm_instr_h(Chunk *ch, size_t ip, int depth) { printf("call #%hhu\n",nargs); break; } + case OP_ENDSCOPE: { + uint8_t nlocals = ch->bc.d[ip++]; + printf("endscope #%hhu\n",nlocals); + break; + } #define RSHORT() (uint16_t)( ch->bc.d[ip-2] | ch->bc.d[ip-1] << 8 ) case OP_SKIP: { ip += 2; -- cgit v1.2.3