From 9f91f103fca6d990619d9666de71090feeda962c Mon Sep 17 00:00:00 2001 From: Skiy Date: Mon, 16 Aug 2021 23:30:44 +0100 Subject: [PATCH] compiler should now be capable of parsing base arithmetic --- Verboscript/common.py | 1 + Verboscript/compiler.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Verboscript/common.py b/Verboscript/common.py index b743040..157c7b4 100644 --- a/Verboscript/common.py +++ b/Verboscript/common.py @@ -5,6 +5,7 @@ # fetch our code # global variables +DEBUG_PRINT_CODE = True DEBUG_TRACE_EXECUTION = True # Useful functions diff --git a/Verboscript/compiler.py b/Verboscript/compiler.py index 9ff4ea2..7f3faf2 100644 --- a/Verboscript/compiler.py +++ b/Verboscript/compiler.py @@ -153,7 +153,14 @@ def emitConstant(value): # handle the safe shutdown of the compiler def endCompiler(): + # emit a return byte emitReturn() + # if the compiler is emiting code + if DEBUG_PRINT_CODE: + # if we didn't have an error + if not parser.hadError: + # then show the chunk + disassembleChunk(compilingChunk, "Code") # handle parentheses for groupings def grouping():