semos/vm.c

18 lines
381 B
C
Raw Permalink Normal View History

2024-04-05 18:16:58 +01:00
#include "compiler.h"
2024-04-05 23:43:45 +01:00
#include "vm.h"
2024-04-05 03:14:35 +01:00
#include <stdlib.h>
void vm_construct(
VM* vm, const Op* program, size_t program_size, size_t stack_size)
{
*vm = (VM) {
.program = program,
.program_size = program_size,
.pc = 0,
.stack = malloc(sizeof(Value) * stack_size),
.stack_size = stack_size,
.sp = 0,
.bp = 0,
};
}