Cicada ---> Online Help Docs ---> Reference
Bytecode operators
Each entry in the following list consists of: a bytecode command word (which is a number), a name in brackets, and then the arguments for that operator separated by commas. Arguments in plain text take up a defined number of bytecode words. Unless otherwise indicated, a fixed-width argument is one word long and should be read as a signed integer. Arguments in italics are themselves bytecode expressions, which can span arbitrary word-lengths.
- 0 [ null ] : marks the end of a code block
- 1 [ jump ], offset : jumps the program counter to the position of the offset word plus offset bytecode words
- 2 [ jump-if-true ], offset, condition : jumps the program counter to the position of the offset word plus offset bytecode words, if the conditional expression evaluates to true
- 3 [ jump-if-false ], offset, condition : moves the program counter to the position of the offset word plus offset byetcode words, if condition is false
- 4 [ code ] : delineates the boundary between two code blocks
- 5 [ return ], return_variable : exits the function and returns the specified variable
- 6 [ user function ], function_variable, args_variable : runs the given user function with the specified arguments, and returns the return variable (if any).
- 7 [ built-in function ], function_ID, args_variable : runs the built-in Cicada function with the given ID and arguments, and sends back any return value
- 8 [ define ], flags, LH_var, RH_var : applies the define/equate/equate-at command specified by the flags from the source RH_var to the target LH_var
- 9 [ forced_equate ], LH_var, RH_var : copies the raw data from the source RH_var into the target LH_var if their byte-sizes match
- 10 [ search member ], ID : searches backwards from the current function for the member having the given ID
- 11 [ step to member ], ID, starting_variable : steps to the member with the given ID from the given starting variable
- 12 [ step to index ], starting_variable, index : steps into the given index of the starting variable
- 13 [ step to indices ], starting_variable, low_index, high_index : steps simultaneously into the given range of indices from the starting variable
- 14 [ step to all indices ], starting_variable : steps into all indices of the starting variable
- 15 [ resize ], variable, top_index : resizes the variable’s member to have the given number of indices, and steps into these indices
- 16 [ insert index ], variable, new_index : adds a new index to variable at position new_index
- 17 [ insert indices ], variable, new_low_index, new_high_index : adds the new range of indices to variable beginning at low_index
- 18 [ remove ], member : deletes the member or part of the member that was stepped into
- 19 [ if equal ], expr1, expr2 : returns true if the two expressions’ data are equal; false otherwise
- 20 [ if not equal ], expr1, expr2 : returns false if the two expressions’ data are equal and true otherwise
- 21 [ if greater-than ], num1, num2 : returns true if and only if num1 is greater than num2
- 22 [ if greater-than-or-equal ], num1, num2 : returns true if and only if num1 is greater than or equal to num2
- 23 [ if less-than ], num1, num2 : returns true if and only if num1 is less than num2
- 24 [ if less-than-or-equal ], num1, num2 : returns true if and only if num1 is less than or equal to num2
- 25 [ if same reference ], expr1, expr2 : returns true if the two members point to the same data; false otherwise
- 26 [ if different reference ], expr1, expr2 : returns false if the two members point to the same data and true otherwise
- 27 [ add ], num1, num2 : returns the sum of its numeric arguments
- 28 [ subtract ], num1, num2 : returns num1 minus num2
- 29 [ multiply ], num1, num2 : returns the product of its numeric arguments
- 30 [ divide ], num1, num2 : returns num1 divided by num2
- 31 [ power ], num1, num2 : returns num1 raised to the power num2
- 32 [ modulo ], num1, num2 : returns the remainder of num1 divided by num2 after they have been truncated to integers
- 33 [ not ], condition : returns true if the condition is false and false if the condition is true
- 34 [ and ], condition1, condition2 : returns true if and only if both conditions are true (both are always evaluated)
- 35 [ or ], condition1, condition2 : returns true if and only if one or both of the conditions are true (both are always evaluated)
- 36 [ xor ], condition1, condition2 : returns true if and only if one, but not both, conditions are true
- 37 [ code number ], code number, var : causes an enclosing function call to execute the given code number of var
- 38 [ substitute code ], code, var : returns var but paired with the given code instead of its native code
- 39 [ append code ], f1, f2 : returns f1 but with the concatenated code f1 + f2 instead of its native code
- 40 [ args ] : returns the args variable for the current function
- 41 [ this ] : returns the function variable that is currently running
- 42 [ that ] : returns the variable on the left-hand side of the equate statement
- 43 [ parent ] : returns the parent of the currently-running function
- 44 [ top ] : returns the highest index of the enclosing array brackets
- 45 [ nothing ] : returns no variable
- 46 [ array ], num_indices, type : an array of num_indices elements of type
- 47 [ bool ] : Boolean data type
- 48 [ char ] : character data type
- 49 [ int ] : integer data type
- 50 [ double ] : floating-point data type
- 51 [ string ] : string data type
- 52 [ constant bool ], num : returns the Boolean stored in num (one bytecode word)
- 53 [ constant char ], num : returns the character stored in num (one bytecode word)
- 54 [ constant int ], num : returns the integer stored in num (one bytecode word)
- 55 [ constant double ], num : returns the floating-point number stored in num (num is sizeof(double)/sizeof(int) bytecode words long)
- 56 [ constant string ], characters_num, string_data : returns an inlined string having the given number of characters. The string_data field occupies one bytecode word for every four characters.
- 57 [ code block ] : returns the inlined code beginning with the next bytecode sentence and ending with a 0 bytecode word
Last update: May 8, 2024