Repl works, also fixed a few small bugs

This commit is contained in:
2025-01-31 10:16:06 +11:00
parent 002651f95d
commit bfed4e23f3
5 changed files with 43 additions and 25 deletions

View File

@@ -982,7 +982,7 @@ void Toy_inheritVM(Toy_VM* vm, Toy_VM* parent) {
Toy_resetVM(vm);
}
void Toy_bindVMToModule(Toy_VM* vm, Toy_Module* module) {
void Toy_bindVM(Toy_VM* vm, Toy_Module* module) {
vm->code = module->code;
vm->jumpsCount = module->jumpsCount;
@@ -1000,6 +1000,11 @@ void Toy_bindVMToModule(Toy_VM* vm, Toy_Module* module) {
}
void Toy_runVM(Toy_VM* vm) {
if (vm->codeAddr == 0) {
//ignore uninitialized VMs or empty modules
return;
}
//TODO: read params into scope
//prep the program counter for execution