diff options
author | ubq323 <ubq323@ubq323.website> | 2024-08-17 12:35:43 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2024-08-17 12:35:43 +0100 |
commit | 05cfb9bf2461785ec621b490747f48b96344017f (patch) | |
tree | 0b9fc13d8509b24c3950c668c9aa4cc28bcfa492 /dis.c | |
parent | 14b6304bb416795ca1016e9ce5f052b0861e5a48 (diff) |
sin, cos, more checks
Diffstat (limited to 'dis.c')
-rw-r--r-- | dis.c | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -10,6 +10,41 @@ static void print_const(Chunk *ch, uint8_t ix) { println_val(k); } + +char *op_name(Op op) { + switch (op) { + case OP_RET: return "ret"; break; + case OP_LOADK: return "loadk"; break; + case OP_ADD: return "add"; break; + case OP_SUB: return "sub"; break; + case OP_MUL: return "mul"; break; + case OP_DIV: return "div"; break; + case OP_MOD: return "mod"; break; + case OP_EQU: return "equ"; break; + case OP_CMP: return "cmp"; break; + case OP_HALT: return "halt"; break; + case OP_DROP: return "drop"; break; + case OP_GETGLOBAL: return "getglobal"; break; + case OP_SETGLOBAL: return "setglobal"; break; + case OP_GETLOCAL: return "getlocal"; break; + case OP_SETLOCAL: return "setlocal"; break; + case OP_TRUE: return "true"; break; + case OP_FALSE: return "false"; break; + case OP_NIL: return "nil"; break; + case OP_0BRANCH: return "0branch"; break; + case OP_SKIP: return "skip"; break; + case OP_REDO: return "redo"; break; + case OP_CALL: return "call"; break; + case OP_TAILCALL: return "tailcall"; break; + case OP_ENDSCOPE: return "endscope"; break; + case OP_ARRNEW: return "arrnew"; break; + case OP_ARRAPPEND: return "arrappend"; break; + case OP_ARRLEN: return "arrlen"; break; + case OP_SETIDX: return "setidx"; break; + default: return "???"; break; + } +} + static void disasm_chunk_h(Chunk *ch, int depth); void disasm_chunk(Chunk *ch) { disasm_chunk_h(ch, 0); |