Skip to content

Arithmetic & Logic

These instructions provide the necessary operations for numerical and logical calculations. Note that for optimization, these instructions require a Primitive Types (sht, hlf, int, flt, lng, dbl, oct) to prevent the VM from guessing the data type during execution.

OpcodeArgumentsOperands (stack)Description
add / subtypeval1, val2Addition or Subtraction
mul / divtypeval1, val2Multiplication or Division
modtypeval1, val2Modulo (Remainder)
negtypevalNegation (-5 to 5, or vice versa)
inc / decname, type-Directly add/remove variable contents (without going through the stack)
gt / lttypeval1, val2Greater Than or Less Than
ge / letypeval1, val2Greater/Less Than or Equal
eq / neqtypeval1, val2Equal or Not Equal
shl / shrtypeval1, val2Shift Left or Shift Right bitwise operation based on data type
rol / rortypeval1, val2Circular Shift Left or Right (Rotate) bitwise operation based on data type
and / or-val1, val2Boolean logic operations (&& / ||)
xor-val1, val2Bitwise Exclusive OR operation between two values
not-val1, val2Bitwise NOT (Inversion) operation on a single value
powtypeval1, val2General power operation (x^y)
powitypeval1, val2Power with integer exponent
powftypeval1, val2Power with floating-point exponent
sin / costypeval1, val2Sine or Cosine trigonometric operation
tantypeval1, val2Tangent trigonometric operation

Released under the Apache-2.0 License.