From 8f9a84345c147da5d398331548753d1e350ce846 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Sun, 24 Oct 2021 12:04:06 +0200 Subject: Add globals and OP_DEF operation --- src/bytecode/main.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/bytecode/main.c') diff --git a/src/bytecode/main.c b/src/bytecode/main.c index f7d1f74..85882b3 100755 --- a/src/bytecode/main.c +++ b/src/bytecode/main.c @@ -8,13 +8,15 @@ // Config. // -// #define DEBUG_TRACE_EXECUTION +#ifdef DEBUG +#define DEBUG_TRACE_EXECUTION +#endif #include "vm.h" +#include "errors.c" #include "compiler.h" #include "ops.h" #include "debug.h" -#include "errors.c" #include "lexer.c" #include "read_line.c" #include "string_view.c" @@ -48,12 +50,14 @@ process_source(const StringView *source) { return; } +#ifdef DEBUG + disassemble_chunk(chunk, "current chunk"); +#endif + // Interpret chunk. vm_interpret(&vm, chunk); - if (errors_n != 0) { - disassemble_chunk(vm.chunk, "current chunk"); - } + // Free resources. chunk_free(chunk); array_free(tokens); } -- cgit v1.2.1