Added remaining opcodes to inspector

Also used some coloring for terminal outputs
This commit is contained in:
2026-04-12 23:01:28 +10:00
parent e24823924a
commit 8eefbc8a0c
5 changed files with 95 additions and 41 deletions

View File

@@ -365,6 +365,11 @@ int repl(const char* filepath, bool verbose) {
continue;
}
unsigned char* bytecode = Toy_compileToBytecode(ast);
if (verbose) {
inspect_bytecode(bytecode);
}
Toy_bindVM(&vm, bytecode, NULL);
//run
@@ -374,7 +379,6 @@ int repl(const char* filepath, bool verbose) {
if (verbose) {
debugStackPrint(vm.stack);
debugScopePrint(vm.scope, 0);
inspect_bytecode(bytecode);
}
//free the memory, and leave the VM ready for the next loop
@@ -460,6 +464,10 @@ int main(int argc, const char* argv[]) {
Toy_freeBucket(&bucket);
free(source);
if (cmd.verbose) {
inspect_bytecode(bytecode);
}
//run the compiled code
Toy_VM vm;
Toy_initVM(&vm);
@@ -471,7 +479,6 @@ int main(int argc, const char* argv[]) {
if (cmd.verbose) {
debugStackPrint(vm.stack);
debugScopePrint(vm.scope, 0);
inspect_bytecode(bytecode);
}
//cleanup