This document details the various operation codes (opcodes) and their respective arguments. Each opcode performs a specific operation, and the provided arguments determine its behavior. Errors occur if the argument count or format is invalid.
- Description: Loads a constant value at a specified index.
- Arguments:
index
(integer): The index of the constant.
- Description: Loads a value from memory to a register.
- Arguments:
register_index
(integer): The index of the register.
- Description: Stores a value into a memory register.
- Arguments:
register_index
(integer): The index of the register.
- Description: Loads a sub-value using an index.
- Arguments:
index
(integer): The field index of the sub-value.
- Description: Removes the top value from the stack.
- Arguments: None.
- Description: Removes multiple values from the stack.
- Arguments:
count
(integer): Number of values to remove.
- Description: Duplicates the top value of the stack.
- Arguments: None.
- Description: Duplicates a value at a specific stack index.
- Arguments:
stack_index
(integer): The index of the stack value to duplicate.
- Description: Swaps the top value with a value at a specific stack index.
- Arguments:
stack_index
(integer): The index of the stack value to swap.
- Description: Swaps two values on the stack.
- Arguments:
a_stack_index
(integer): Index of the first value.b_stack_index
(integer): Index of the second value.
- Description: Jumps to a specified address or label.
- Arguments:
addr
(integer or label): Target address or label prefixed by:
.
- Description: Jumps to a specified address or label if the condition is false.
- Arguments:
addr
(integer or label): Target address or label prefixed by:
.
- Description: Retrieves the length of an iterable.
- Arguments: None.
- Description: Begins iteration over an iterable.
- Arguments: None.
- Description: Moves the iterator to the next item or jumps to a label if iteration ends.
- Arguments:
addr
(integer or label): Target address or label prefixed by:
.
- Description: Ends iteration.
- Arguments: None.
- Description: Ends the execution of the current chunk or function.
- Arguments: None.
- Description: Accesses an array element by index.
- Arguments:
index
(integer): Index of the array element.
- Description: Casts a value to a specific primitive type.
- Arguments:
primitive_type_id
(integer): Identifier of the target type.
- Description: Invokes a chunk of code with parameters.
- Arguments:
chunk_id
(integer or label): Identifier or label of the chunk.on_value
(boolean): Whether the chunk operates on a value.args_count
(integer): Number of arguments passed.
- Description: Invokes a system call.
- Arguments:
sys_call_id
(integer): Identifier of the system call.on_value
(boolean): Whether the call operates on a value.args_count
(integer): Number of arguments passed.
- Description: Creates a new array with a specified length.
- Arguments:
length
(integer): Number of elements.
- Description: Creates a new struct with a specified ID.
- Arguments:
struct_id
(integer): Identifier of the struct.
- Description: Creates a new range object.
- Arguments: None.
- Description: Creates a new map with a specified length.
- Arguments:
length
(integer): Number of key-value pairs.
- Description: Negates the top value on the stack.
- Arguments: None.
Perform arithmetic operations on values on the stack.
OpCode | Description | Arguments |
---|---|---|
ADD | Addition | None |
SUB | Subtraction | None |
MUL | Multiplication | None |
DIV | Division | None |
MOD | Modulus | None |
POW | Power | None |
Perform logical and bitwise operations.
OpCode | Description | Arguments |
---|---|---|
AND | Logical AND | None |
OR | Logical OR | None |
XOR | Logical XOR | None |
SHL | Bitwise shift left | None |
SHR | Bitwise shift right | None |
Compare values on the stack.
OpCode | Description | Arguments |
---|---|---|
EQ | Equality check | None |
GT | Greater than | None |
LT | Less than | None |
GTE | Greater or equal | None |
LTE | Less or equal | None |
Modify values on the stack or in memory.
OpCode | Description | Arguments |
---|---|---|
ASSIGN | Basic assignment | None |
ASSIGNADD | Assignment with addition | None |
ASSIGNSUB | Assignment with subtraction | None |
(Additional ASSIGN*
opcodes follow similar rules.)
Modify values by 1.
OpCode | Description | Arguments |
---|---|---|
INC | Increment | None |
DEC | Decrement | None |