Files
bshell/bshell.runtime/include/bshell/runtime/opcode.h
T
wash edfb3e24a3 bshell: re-organise build into three separate components
bshell: the front-end binary
bshell.runtime: contains the parser, compiler, and classes needed to run bshell scripts
bshell.core: contains the builtin commandlets and aliases
2026-05-25 10:33:29 +01:00

83 lines
1.7 KiB
C

#ifndef BSHELL_RUNTIME_OPCODE_H_
#define BSHELL_RUNTIME_OPCODE_H_
#include <stdint.h>
#define BSHELL_INSTRUCTION_INVALID 0xFFFFFFFF
typedef uint32_t bshell_instruction;
enum bshell_opcode {
BSHELL_OPCODE_NOP = 0,
BSHELL_OPCODE_LDC_INT,
BSHELL_OPCODE_LDC_STR,
BSHELL_OPCODE_LDC_FP,
BSHELL_OPCODE_LDGLOBAL,
BSHELL_OPCODE_LDLOCAL,
BSHELL_OPCODE_LDBLOCK,
BSHELL_OPCODE_LDENV,
BSHELL_OPCODE_LDSTATIC,
BSHELL_OPCODE_LDARG,
BSHELL_OPCODE_LDPROP,
BSHELL_OPCODE_LDELEM,
BSHELL_OPCODE_LDELEM_C,
BSHELL_OPCODE_STLOCAL,
BSHELL_OPCODE_STPROP,
BSHELL_OPCODE_STELEM,
BSHELL_OPCODE_LDCMD,
BSHELL_OPCODE_PEXEC,
BSHELL_OPCODE_CALL,
BSHELL_OPCODE_MK_STR,
BSHELL_OPCODE_MK_ARRAY,
BSHELL_OPCODE_MK_HTAB,
BSHELL_OPCODE_POP,
BSHELL_OPCODE_ADD,
BSHELL_OPCODE_SUB,
BSHELL_OPCODE_MUL,
BSHELL_OPCODE_DIV,
BSHELL_OPCODE_ADD_IP,
BSHELL_OPCODE_MOD,
BSHELL_OPCODE_INC,
BSHELL_OPCODE_DEC,
BSHELL_OPCODE_SHL,
BSHELL_OPCODE_SHR,
BSHELL_OPCODE_BAND,
BSHELL_OPCODE_BOR,
BSHELL_OPCODE_BXOR,
BSHELL_OPCODE_BNOT,
BSHELL_OPCODE_CMP_NULL,
BSHELL_OPCODE_CMP_EQ,
BSHELL_OPCODE_CMP_NE,
BSHELL_OPCODE_CMP_LT,
BSHELL_OPCODE_CMP_GT,
BSHELL_OPCODE_CMP_LE,
BSHELL_OPCODE_CMP_GE,
BSHELL_OPCODE_LAND,
BSHELL_OPCODE_LOR,
BSHELL_OPCODE_LXOR,
BSHELL_OPCODE_LNOT,
BSHELL_OPCODE_BR,
BSHELL_OPCODE_BR_TRUE,
BSHELL_OPCODE_RANGE,
BSHELL_OPCODE_MATCH,
BSHELL_OPCODE_REPLACE,
BSHELL_OPCODE_LIKE,
BSHELL_OPCODE_IN,
BSHELL_OPCODE_FMT,
BSHELL_OPCODE_CONTAINS,
BSHELL_OPCODE_SPLIT,
BSHELL_OPCODE_JOIN,
BSHELL_OPCODE_IS,
BSHELL_OPCODE_AS,
};
extern bshell_instruction bshell_instruction_encode(
enum bshell_opcode opcode,
uint32_t arg);
extern void bshell_instruction_decode(
bshell_instruction instr,
enum bshell_opcode *out_opcode,
uint32_t *out_arg);
#endif