Newer
Older
Tardis / lang / vm.h
// SPDX-License-Identifier: MIT
// Copyright (c) 2023 John Watts and the LuminaSensum contributors

#ifndef VM_H
#define VM_H

#include "types.h"

VmState vm_create(void);
void vm_destroy(VmState *state);

void vm_stack_set(VmState state, int index, Object obj);
Object vm_stack_get(VmState state, int index);
void vm_stack_push(VmState state, Object obj);
Object vm_stack_pop(VmState state);
void vm_stack_drop(VmState state, int count);
int vm_stack_depth(VmState state);

void vm_call(VmState state, Object obj, const char *name, int arg_count);

#endif