Expand description

Instruction bytecode

Bytecode represents a state in the parse -> compile -> interpret pipeline. It is the output of the compiler and the input of a VirtualMachine.

All instructions are 32 bits, with the first byte being the opcode and the remaining 3 bytes being used for operands. The opcode byte determines how the operand bytes are interpreted.

For the opcode byte, the first 2 bits are the SuperCode. This bit field separates the opcode into 4 instruction categories: arithmetic, comparison, index, and misc. The remaining 6 bits of the opcode are interpreted differently depending on the category.

Modules

Representation of the opcode byte

Representation of the operand bytes

Structs

Transparent wrapper around an unsigned 32 bit integer

Compiled function

Functions