shithub: femtolisp

ref: 465e49a46ffd47fde8b915202773bcc9b34eec57
dir: /opcodes.h/

View raw version
enum {
    OP_LOADA0,
    OP_LOADA1,
    OP_LOADV,
    OP_BRF,
    OP_POP,
    OP_CALL,
    OP_TCALL,
    OP_LOADG,
    OP_LOADA,
    OP_LOADC,
    OP_RET,
    OP_DUP,
    OP_CAR,
    OP_CDR,
    OP_CLOSURE,
    OP_SETA,
    OP_JMP,
    OP_LOADC00,
    OP_PAIRP,
    OP_BRNE,
    OP_LOADT,
    OP_LOAD0,
    OP_LOADC01,
    OP_AREF,
    OP_ATOMP,
    OP_BRT,
    OP_BRNN,
    OP_LOAD1,
    OP_LT,
    OP_ADD2,
    OP_SETCDR,
    OP_LOADF,
    OP_CONS,
    OP_EQ,
    OP_SYMBOLP,
    OP_NOT,
    OP_CADR,
    OP_NEG,
    OP_NULLP,
    OP_BOOLEANP,
    OP_NUMBERP,
    OP_FIXNUMP,
    OP_BOUNDP,
    OP_BUILTINP,
    OP_FUNCTIONP,
    OP_VECTORP,
    OP_NOP,
    OP_SETCAR,
    OP_JMPL,
    OP_BRFL,
    OP_BRTL,
    OP_EQV,
    OP_EQUAL,
    OP_LIST,
    OP_APPLY,
    OP_ADD,
    OP_SUB,
    OP_MUL,
    OP_DIV,
    OP_IDIV,
    OP_NUMEQ,
    OP_COMPARE,
    OP_ARGC,
    OP_VECTOR,
    OP_ASET,
    OP_LOADNIL,
    OP_LOADI8,
    OP_LOADVL,
    OP_LOADGL,
    OP_LOADAL,
    OP_LOADCL,
    OP_SETG,
    OP_SETGL,
    OP_SETAL,
    OP_SETC,
    OP_SETCL,
    OP_VARGC,
    OP_TRYCATCH,
    OP_FOR,
    OP_TAPPLY,
    OP_SUB2,
    OP_LARGC,
    OP_LVARGC,
    OP_CALLL,
    OP_TCALLL,
    OP_BRNEL,
    OP_BRNNL,
    OP_BRN,
    OP_BRNL,
    OP_OPTARGS,
    OP_BRBOUND,
    OP_KEYARGS,
    OP_BOOL_CONST_F,
    OP_BOOL_CONST_T,
    OP_THE_EMPTY_LIST,
    OP_EOF_OBJECT,
    N_OPCODES
};

static const Builtin builtins[] = {
    [OP_NUMBERP] = {"number?", 1},
    [OP_NUMEQ] = {"=", 2},
    [OP_BOOLEANP] = {"boolean?", 1},
    [OP_IDIV] = {"div0", 2},
    [OP_DIV] = {"/", -1},
    [OP_PAIRP] = {"pair?", 1},
    [OP_ATOMP] = {"atom?", 1},
    [OP_SYMBOLP] = {"symbol?", 1},
    [OP_APPLY] = {"apply", -2},
    [OP_BOUNDP] = {"bound?", 1},
    [OP_EQV] = {"eqv?", 2},
    [OP_NOT] = {"not", 1},
    [OP_SUB] = {"-", -1},
    [OP_NULLP] = {"null?", 1},
    [OP_CAR] = {"car", 1},
    [OP_VECTOR] = {"vector", ANYARGS},
    [OP_ASET] = {"aset!", 3},
    [OP_FUNCTIONP] = {"function?", 1},
    [OP_EQ] = {"eq?", 2},
    [OP_BUILTINP] = {"builtin?", 1},
    [OP_LIST] = {"list", ANYARGS},
    [OP_AREF] = {"aref", 2},
    [OP_FIXNUMP] = {"fixnum?", 1},
    [OP_VECTORP] = {"vector?", 1},
    [OP_ADD] = {"+", ANYARGS},
    [OP_CONS] = {"cons", 2},
    [OP_SETCDR] = {"set-cdr!", 2},
    [OP_COMPARE] = {"compare", 2},
    [OP_SETCAR] = {"set-car!", 2},
    [OP_LT] = {"<", 2},
    [OP_EQUAL] = {"equal?", 2},
    [OP_MUL] = {"*", ANYARGS},
    [OP_CADR] = {"cadr", 1},
    [OP_CDR] = {"cdr", 1},
};