next: CHOOSE opcode + better compiler error reporting

This commit is contained in:
Lobo 2026-02-08 11:46:19 -03:00
parent 0e3d9f68e0
commit 1746d12266
5 changed files with 46 additions and 13 deletions

View file

@ -250,6 +250,17 @@ int growl_vm_execute(GrowlVM *vm, GrowlQuotation *quot) {
growl_push(vm, growl_rpop(vm));
VM_NEXT();
}
VM_OP(CHOOSE) {
Growl cond = growl_pop(vm);
Growl f = growl_pop(vm);
Growl t = growl_pop(vm);
if (cond != GROWL_NIL) {
growl_push(vm, t);
} else {
growl_push(vm, f);
}
VM_NEXT();
}
VM_OP(CALL) {
Growl obj = growl_pop(vm);
callstack_push(vm, vm->current_quotation, vm->ip);