From d9474f1d7c0c6674179fd0f27cd1c084c8227ed5 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Fri, 22 Oct 2021 12:05:41 +0200 Subject: Add interpretation function for VM --- src/bytecode/main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/bytecode/main.c') diff --git a/src/bytecode/main.c b/src/bytecode/main.c index ca1f441..9a81aaa 100644 --- a/src/bytecode/main.c +++ b/src/bytecode/main.c @@ -4,8 +4,13 @@ #include #include -#include "vm.h" +// +// Config. +// + +// #define DEBUG_TRACE_EXECUTION +#include "vm.h" #include "ops.h" #include "debug.h" #include "errors.c" @@ -39,8 +44,10 @@ process_source(const StringView *source) { add_code(vm.chunk, const_idx, 1, 1); add_code(vm.chunk, OP_RETURN, 1, 1); - // Disassemble the chunk. - disassemble_chunk(vm.chunk, "test chunk"); + vm_interpret(vm); + if (errors_n != 0) { + disassemble_chunk(vm.chunk, "test chunk"); + } array_free(tokens); } -- cgit v1.2.1