52 lines
1.3 KiB
C
52 lines
1.3 KiB
C
#ifndef MK_MOKA_H
|
|
#define MK_MOKA_H
|
|
|
|
#include "commons.h"
|
|
#include "vec.h"
|
|
#include "value.h"
|
|
|
|
typedef size_t MOKA;
|
|
|
|
struct frame
|
|
{
|
|
struct vec stack;
|
|
struct vec local_values;
|
|
};
|
|
|
|
struct moka
|
|
{
|
|
struct vec frame_stack;
|
|
struct vec global_values;
|
|
};
|
|
|
|
void moka_init(struct moka* self);
|
|
void frame_init(struct frame* self);
|
|
void frame_free(struct frame* self);
|
|
void moka_free(struct moka* self);
|
|
|
|
struct frame* moka_frame(struct moka* self);
|
|
bool moka_has_top(struct moka* self);
|
|
MOKA moka_top(struct moka* self);
|
|
|
|
bool moka_is(struct moka* self, MOKA value, TypeKind type);
|
|
TypeKind moka_type_of(struct moka* self, MOKA value);
|
|
|
|
void moka_dump(struct moka* self, MOKA value);
|
|
|
|
MOKA moka_push_int(struct moka* self, int value, int line);
|
|
int moka_get_int(struct moka* self, MOKA value);
|
|
|
|
MOKA moka_push_float(struct moka* self, float value, int line);
|
|
float moka_get_float(struct moka* self, MOKA value);
|
|
|
|
MOKA moka_push_bool(struct moka* self, bool value, int line);
|
|
float moka_get_bool(struct moka* self, MOKA value);
|
|
|
|
MOKA moka_push_string(struct moka* self, char const* value, int line);
|
|
char* moka_get_string(struct moka* self, MOKA value);
|
|
|
|
MOKA moka_push_symbol(struct moka* self, char const* value, int line);
|
|
char* moka_get_symbol(struct moka* self, MOKA value);
|
|
|
|
#endif
|