17 lines
359 B
C
17 lines
359 B
C
#include "vm.h"
|
|
#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,
|
|
};
|
|
}
|