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():