36 lines
762 B
C
36 lines
762 B
C
#ifndef BYTECODE_H
|
|
#define BYTECODE_H
|
|
|
|
#include "common/string.h"
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
typedef enum {
|
|
ScirptInstructionTypeReserve,
|
|
ScirptInstructionTypePushInt,
|
|
ScirptInstructionTypePushFloat,
|
|
ScirptInstructionTypePushString,
|
|
ScirptInstructionTypePushBool,
|
|
ScirptInstructionTypePop,
|
|
ScirptInstructionTypeAdd,
|
|
ScirptInstructionTypeSubtract,
|
|
ScirptInstructionTypeMultiply,
|
|
ScirptInstructionTypeDivide,
|
|
ScirptInstructionTypeModulo,
|
|
ScirptInstructionTypeExponent,
|
|
} ScirptInstructionType;
|
|
|
|
typedef struct {
|
|
ScirptInstructionType type;
|
|
union {
|
|
size_t reserve_amount;
|
|
int64_t push_int_value;
|
|
double push_float_value;
|
|
HeapString push_string_value;
|
|
bool push_bool_value;
|
|
};
|
|
} ScirptInstruction;
|
|
|
|
#endif
|