hotwire haku2 into rkgk

really a bodge job right now and it crashes but it's a start
This commit is contained in:
りき萌 2025-06-04 00:28:21 +02:00
parent 550227da34
commit 5de4f9d7c6
9 changed files with 178 additions and 71 deletions

View file

@ -113,6 +113,14 @@ pub fn pop(vm: *Vm) Error!Value {
return vm.stack[vm.stack_top];
}
pub fn top(vm: *const Vm) Value {
if (vm.stack_top > 0) {
return vm.stack[vm.stack_top - 1];
} else {
return .nil;
}
}
pub fn pushCall(vm: *Vm, frame: CallFrame) Error!void {
if (vm.call_stack_top >= vm.call_stack.len) {
return vm.throw("too much recursion", .{});