Each instruction is a 1-byte opcode optionally followed by operand bytes. Stack effect is the net change in stack height.
| Opcode | Operands | Stack effect | Meaning |
|---|---|---|---|
| CONST | const-idx (1B) | +1 | push constant |
| NIL / TRUE / FALSE | — | +1 | push literal |
| POP | — | -1 | discard top |
| LOAD_LOCAL / STORE_LOCAL | slot (1B) | +1 / 0 | frame-relative local |
| LOAD_GLOBAL / STORE_GLOBAL / DEFINE_GLOBAL | name-idx (1B) | +1 / 0 / -1 | globals table |
| LOAD_UPVAL / STORE_UPVAL | uv-idx (1B) | +1 / 0 | captured variable |
| CLOSE_UPVAL | — | -1 | move local to heap upvalue |
| ADD/SUB/MUL/DIV/MOD | — | -1 | binary arithmetic (ADD also concats) |
| NEG / NOT | — | 0 | unary |
| EQ/NEQ/LT/LE/GT/GE | — | -1 | comparisons |
| JUMP / JUMP_IF_FALSE | offset (2B) | 0 / -1 | forward branch |
| LOOP | offset (2B) | 0 | backward branch |
| CALL | argc (1B) | -(argc) | invoke closure |
| CLOSURE | fn-idx (1B) + [is_local,index]xN | +1 | build closure, capture upvalues |
| RETURN | — | — | pop frame, return value |
| — | -1 | print top |