ReefVM/src/opcode.ts

66 lines
777 B
TypeScript

export enum OpCode {
// stack
PUSH, // operand: constant index (number)
POP, // operand: none
DUP, // operand: none
// variables
LOAD, // operand: variable name (string)
STORE, // operand: variable name (string)
// math
ADD,
SUB,
MUL,
DIV,
MOD,
// comparison
EQ,
NEQ,
LT,
GT,
LTE,
GTE,
// logical
NOT,
// control flow
JUMP,
JUMP_IF_FALSE,
JUMP_IF_TRUE,
BREAK,
CONTINUE,
// exception handling
PUSH_TRY,
PUSH_FINALLY,
POP_TRY,
THROW,
// functions
MAKE_FUNCTION,
CALL,
TAIL_CALL,
RETURN,
// arrays
MAKE_ARRAY,
ARRAY_GET,
ARRAY_SET,
ARRAY_PUSH,
ARRAY_LEN,
// dicts
MAKE_DICT,
DICT_GET,
DICT_SET,
DICT_HAS,
// typescript interop
CALL_NATIVE,
// special
HALT
}