Instruction Set
Documentation on the supported instructions of the plushi interpreter.
boolean_and
Input Types: [:boolean :boolean]Output Types: [:boolean]
Pushes the result of calling AND on the top two booleans.
boolean_dup
Input Types: [:boolean]Output Types: [:boolean :boolean]
boolean_dup_times
Input Types: [:boolean :integer]Output Types: [:exec]
boolean_from_float
Input Types: [:float]Output Types: [:boolean]
Pushes false if the top float is zero. Pushes true for any other value of float.
boolean_from_integer
Input Types: [:integer]Output Types: [:boolean]
Pushes false if the top integer is zero. Pushes true for any other value of integer.
boolean_invert_first_then_and
Input Types: [:boolean :boolean]Output Types: [:boolean]
Pushes the result of inverting the top boolean and then calling AND on the second boolean.
boolean_invert_second_then_and
Input Types: [:boolean :boolean]Output Types: [:boolean]
Pushes the result of inverting the second boolean and then calling AND on the top boolean.
boolean_not
Input Types: [:boolean]Output Types: [:boolean]
Pushes the result of calling NOT on the top boolean.
boolean_or
Input Types: [:boolean :boolean]Output Types: [:boolean]
Pushes the result of calling OR on the top two booleans.
boolean_pop
Input Types: [:boolean]Output Types: []
boolean_print
Input Types: [:boolean]Output Types: [:stdout]
boolean_xor
Input Types: [:boolean :boolean]Output Types: [:boolean]
Pushes the result of calling XOR on the top two booleans.
char_concat
Input Types: [:char :char]Output Types: [:string]
Concatenates the top two char and pushes the resulting string.
char_from_first_char
Input Types: [:string]Output Types: [:char]
Pushes a char of the first character of the top string.
char_from_last_char
Input Types: [:string]Output Types: [:char]
Pushes a char of the last character of the top string.
char_from_nth_char
Input Types: [:string :integer]Output Types: [:char]
Pushes a char of the nth character of the top string. The top integer denotes nth position.
char_print
Input Types: [:char]Output Types: [:stdout]
close
Input Types: []Output Types: []
Denotes a close marker in the program used by control structures.
code_dup
Input Types: [:code]Output Types: [:code :code]
code_dup_times
Input Types: [:code :integer]Output Types: [:exec]
code_pop
Input Types: [:code]Output Types: []
exec_if
Input Types: [:boolean :exec :exec]Output Types: [:exec]
If the top boolean is true, execute the top element of the exec
stack and skip the second. Otherwise, skip the top element of the
exec stack and execute the second.float_add
Input Types: [:float :float]Output Types: [:float]
Adds the top two floats and pushes the result.
float_cos
Input Types: [:float]Output Types: [:float]
Pushes the cos of the top float.
float_dec
Input Types: [:float]Output Types: [:float]
Decrements the top float by 1.
float_div
Input Types: [:float :float]Output Types: [:float]
Divides the top two floats and pushes the result.
float_dup
Input Types: [:float]Output Types: [:float :float]
float_dup_times
Input Types: [:float :integer]Output Types: [:exec]
float_from_boolean
Input Types: [:boolean]Output Types: [:float]
Pushes 1.0 in the top boolean is true. Pushes 0.0 if the top boolean is false.
float_from_integer
Input Types: [:integer]Output Types: [:float]
Casts the top integer to a float and pushes the result.
float_gt
Input Types: [:float :float]Output Types: [:boolean]
Pushes true if the top float is greater than the second. Pushes false otherwise.
float_gte
Input Types: [:float :float]Output Types: [:boolean]
Pushes true if the top float is greater than, or equal to, the second. Pushes false otherwise.
float_inc
Input Types: [:float]Output Types: [:float]
Increments the top float by 1.
float_lt
Input Types: [:float :float]Output Types: [:boolean]
Pushes true if the top float is less than the second. Pushes false otherwise.
float_lte
Input Types: [:float :float]Output Types: [:boolean]
Pushes true if the top float is less than, or equal to, the second. Pushes false otherwise.
float_max
Input Types: [:float :float]Output Types: [:float]
Pushes the maximum of two float
float_min
Input Types: [:float :float]Output Types: [:float]
Pushes the minimum of two float
float_mod
Input Types: [:float :float]Output Types: [:float]
Computes the modulous of the top two floats and pushes the result.
float_mult
Input Types: [:float :float]Output Types: [:float]
Multiplies the top two floats and pushes the result.
float_pop
Input Types: [:float]Output Types: []
float_print
Input Types: [:float]Output Types: [:stdout]
float_sin
Input Types: [:float]Output Types: [:float]
Pushes the sin of the top float.
float_sub
Input Types: [:float :float]Output Types: [:float]
Subtracts the top two floats and pushes the result.
float_tan
Input Types: [:float]Output Types: [:float]
Pushes the tan of the top float.
integer_add
Input Types: [:integer :integer]Output Types: [:integer]
Adds the top two integers and pushes the result.
integer_dec
Input Types: [:integer]Output Types: [:integer]
Decrements the top integer by 1.
integer_div
Input Types: [:integer :integer]Output Types: [:integer]
Divides the top two integers and pushes the result.
integer_dup
Input Types: [:integer]Output Types: [:integer :integer]
integer_dup_times
Input Types: [:integer :integer]Output Types: [:exec]
integer_from_boolean
Input Types: [:boolean]Output Types: [:integer]
Pushes 1 in the top boolean is true. Pushes 0 if the top boolean is false.
integer_from_float
Input Types: [:float]Output Types: [:integer]
Casts the top float to an integer and pushes the result.
integer_gt
Input Types: [:integer :integer]Output Types: [:boolean]
Pushes true if the top integer is greater than the second. Pushes false otherwise.
integer_gte
Input Types: [:integer :integer]Output Types: [:boolean]
Pushes true if the top integer is greater than, or equal to, the second. Pushes false otherwise.
integer_inc
Input Types: [:integer]Output Types: [:integer]
Increments the top integer by 1.
integer_lt
Input Types: [:integer :integer]Output Types: [:boolean]
Pushes true if the top integer is less than the second. Pushes false otherwise.
integer_lte
Input Types: [:integer :integer]Output Types: [:boolean]
Pushes true if the top integer is less than, or equal to, the second. Pushes false otherwise.
integer_max
Input Types: [:integer :integer]Output Types: [:integer]
Pushes the maximum of two integer
integer_min
Input Types: [:integer :integer]Output Types: [:integer]
Pushes the minimum of two integer
integer_mod
Input Types: [:integer :integer]Output Types: [:integer]
Computes the modulous of the top two integers and pushes the result.
integer_mult
Input Types: [:integer :integer]Output Types: [:integer]
Multiplies the top two integers and pushes the result.
integer_pop
Input Types: [:integer]Output Types: []
integer_print
Input Types: [:integer]Output Types: [:stdout]
integer_sub
Input Types: [:integer :integer]Output Types: [:integer]
Subtracts the top two integers and pushes the result.
noop
Input Types: []Output Types: []
A noop instruction which does nothing.
noop_open
Input Types: []Output Types: []
A noop instruction which does nothing. Opens a code block.
string_concat
Input Types: [:string :string]Output Types: [:string]
Concatenates the top two string and pushes the resulting string.
string_contains_char
Input Types: [:string :char]Output Types: [:boolean]
Pushes true if the next char is in the top string. Pushes false otherwise.
string_contains_string
Input Types: [:string :string]Output Types: [:boolean]
Pushes true if the next string is in the top string. Pushes false otherwise.
string_drop_first
Input Types: [:string]Output Types: [:string]
Pushes the top string without the first character. N is the top integer.
string_drop_head
Input Types: [:string :integer]Output Types: [:string]
Pushes the top string without the first n characters. N is the top integer.
string_drop_last
Input Types: [:string]Output Types: [:string]
Pushes the top string without the last character. N is the top integer.
string_drop_tail
Input Types: [:string :integer]Output Types: [:string]
Pushes the top string without the last n characters. N is the top integer.
string_dup
Input Types: [:string]Output Types: [:string :string]
string_dup_times
Input Types: [:string :integer]Output Types: [:exec]
string_from_first_char
Input Types: [:string]Output Types: [:string]
Pushes a string of the first character of the top string.
string_from_last_char
Input Types: [:string]Output Types: [:string]
Pushes a string of the last character of the top string.
string_from_nth_char
Input Types: [:string :integer]Output Types: [:string]
Pushes a string of the nth character of the top string. The top integer denotes nth position.
string_head
Input Types: [:string :integer]Output Types: [:string]
Pushes a string of the first n characters from the top string. N is the top integer.
string_index_of_char
Input Types: [:string :char]Output Types: [:integer]
Pushes the index of the next :char in the top string. If not found, pushes -1.
string_index_of_string
Input Types: [:string :string]Output Types: [:integer]
Pushes the index of the next :string in the top string. If not found, pushes -1.
string_occurrences_of_char
Input Types: [:string :char]Output Types: [:integer]
Pushes the number of times the next char occurs in the top string.
string_occurrences_of_string
Input Types: [:string :string]Output Types: [:integer]
Pushes the number of times the next string occurs in the top string.
string_pop
Input Types: [:string]Output Types: []
string_print
Input Types: [:string]Output Types: [:stdout]
string_replace_char
Input Types: [:string :char :char]Output Types: [:string]
Replaces all occurances of a char in the top string with another char.
string_replace_first_char
Input Types: [:string :char :char]Output Types: [:string]
Replaces the first occurance of a char in the top string with another char.
string_replace_first_string
Input Types: [:string :string :string]Output Types: [:string]
Replaces the first occurance of a string in the top string with another string.
string_replace_string
Input Types: [:string :string :string]Output Types: [:string]
Replaces all occurances of a string in the top string with another string.
string_substring
Input Types: [:string :integer :integer]Output Types: [:string]
Pushes a substring of the top string based on the top two integers.
string_tail
Input Types: [:string :integer]Output Types: [:string]
Pushes a string of the last n characters from the top string. N is the top integer.