aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytecode/main.c')
-rwxr-xr-xsrc/bytecode/main.c14
1 files changed, 9 insertions, 5 deletions
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 @@
8// Config. 8// Config.
9// 9//
10 10
11// #define DEBUG_TRACE_EXECUTION 11#ifdef DEBUG
12#define DEBUG_TRACE_EXECUTION
13#endif
12 14
13#include "vm.h" 15#include "vm.h"
16#include "errors.c"
14#include "compiler.h" 17#include "compiler.h"
15#include "ops.h" 18#include "ops.h"
16#include "debug.h" 19#include "debug.h"
17#include "errors.c"
18#include "lexer.c" 20#include "lexer.c"
19#include "read_line.c" 21#include "read_line.c"
20#include "string_view.c" 22#include "string_view.c"
@@ -48,12 +50,14 @@ process_source(const StringView *source) {
48 return; 50 return;
49 } 51 }
50 52
53#ifdef DEBUG
54 disassemble_chunk(chunk, "current chunk");
55#endif
56
51 // Interpret chunk. 57 // Interpret chunk.
52 vm_interpret(&vm, chunk); 58 vm_interpret(&vm, chunk);
53 if (errors_n != 0) {
54 disassemble_chunk(vm.chunk, "current chunk");
55 }
56 59
60 // Free resources.
57 chunk_free(chunk); 61 chunk_free(chunk);
58 array_free(tokens); 62 array_free(tokens);
59} 63}