Friendly Persuasion Documentation
The Friendly Persuasion "instruction set" is listed below. The first column is the command, the second is its implied language (the way it should be thought of when writing) and the third is its function.
Input and Output
Command | Implied Language | Function |
IN <variable> | (read) IN (user input into) <variable> | Waits for user input and reads it into the provided variable. |
OUT <element> | OUT(put) <element> (to the console) | Outputs provided text or variable to the console, with a newline character. |
OUTWN <element> | OUTWN (output without newline) <element> (to the console) | Outputs provided text or variable to the console without a newline character. |
Variables and Casting
CAST <variable> <type> <variable> | CAST (variable) <variable> (to type) <type> (and store result in) <variable> | Converts a given variable of one type to the specified type. |
CHR <name> <value> | (make a) CHR (character variable named) <name> (with value) <value> | Creates a character variable of specified name and value. |
FLT <name> <value> | (make a) FLT (float variable named) <name> (with value) <value> | Creates a float variable of specified name and value. |
INT <name> <value> | (make an) INT(eger variable named) <name> (with value) <value> | Creates an integer variable of specified name and value. |
STORE <value> <variable> | STORE (the) <value> (in) <variable> | Stores the provided value (or value within variable) in the provided variable. |
STR <name> <size> <text> | STR(ing with name) <name> (of size) <size> (with text) <text> | Creates a string variable of specified name, size, and text. |
Arrays
ARR <type> <name> <size> {<elements>} | ARR(ay of) <type> (with) <name> (of) <size> (containing) {<elements>} | Creates an array of specified type, name, and size with specified elements. |
INDEX <array> <index> <variable> | INDEX (array) <array> (at index) <index> (and store result in) <variable> | Indexes into the specified array at specified index and stores the result in the provided variable. |
INSERT <array> <index> <value> | INSERT (into array) <array> (at index) <index> (the value) <value> | Inserts provided value into specified array at provided index. |
Determination Statements
DETERMINE <operation> | DETERMINE (if) <operation> | Determines if a given operation is true or false; only if it is true, it executes the code within. |
END | END (determination, otherwise or next statement) | Marks the end of a segment of code to be executed following determine, otherwise, or next. |
NEXT <operation> | NEXT (determine if) <operation> | Determines if a given operation is true or false; only if the previous determine statement is false. |
OTHERWISE | OTHERWISE | Executes code following the statement; only if the previous determine statement(s) is/are false. |
Determination Operators
<value> GEQ <value> | <value> GEQ (greater than or equal to) <value> | Compares two values, returning true if the first is greater than or equal to the second. |
<value> GREATER <value> | <value> GREATER (than) <value> | Compares two values, returning true if the first value is greater than the second. |
<value> IS <value> | <value> IS (equal to) <value> | Compares two values, returning true if the first value is equal to the second. |
<value> ISN’T <value> | <value> ISN’T (equal to) <value> | Compares two values, returning true if the first value is not equal to the second. |
<value> LESS <value> | <value> LESS (than) <value> | Compares two values, returning true if the first value is less than the second. |
<value> LEQ <value> | <value> LEQ (less than or equal to) <value> | Compares two values, returning true if the first value is less than or equal to the second. |
<string> SAYS <string> | Compares two strings, returning true if the first string is equal to the second. |
Logical Operators
<value> AND <value> <variable> | (evaluate) <value> AND <value> (and store result in) <variable> | Evaluates two booleans with operator and, and stores result in <variable> (true only if both are true). |
<value> BAND <value> <variable> | (evaluate) <value> BAND (bitwise and) <value> (and store result in) <variable> | Evaluates two numbers with operator bitwise and, and stores result in <variable> (returns value of corresponding bits). |
<value> BOR <value> <variable> | (evaluate) <value> BOR (bitwise or) <value> (and store result in) <variable> | Evaluates two numbers with operator bitwise or, and stores result in <variable> (returns value of bits which are either true or false). |
<value> NAND <value> <variable> | (evaluate) <value> NAND (not and) <value> (and store result in) <variable> | Evaluates two booleans with operator nand, and stores result in <variable> (true only if at least one is false). |
<value> NOR <value> <variable> | (evaluate) <value> NOR (not or) <value> (and store result in) <variable> | Evaluates two booleans with operator nand, and stores result in <variable> (true only if neither are true). |
NOT <value> <variable> | NOT (negate) <value> (and store result in) <variable> | Evaluates the opposite of a boolean and stores result in <variable>. |
<value> OR <value> <variable> | (evaluate) <value> OR <value> (and store result in) <variable> | Evaluates two booleans with operator and, and stores result in <variable> (true only if one is true). |
Labels
JUMP <label> | JUMP (to) <label> | Jumps to the specified label. |
LABEL <name> | (create a) LABEL (with name) <name> | Creates a label (a marker for a place in a program) of specified name. |
Math Operations
ADD <value> <value> <variable> | ADD <value> (to) <value> (and store the result in) <variable> | Adds two values together, storing the result in the specified variable. |
DEC <variable> | DEC(rement) <variable> (and store result in variable) | Subtracts one to the specified variable and stores the result within itself. |
DIV <value> <value> <variable> | DIV(ide) <value> (by) <value> (and store the result in) <variable> | Divides two values, storing the result in the specified variable. |
INC <variable> | INC(rement) <variable> (and store result in variable) | Adds one to the specified variable and stores the result within itself. |
MUL <value> <value> <variable> | MUL(tiply) <value> (and) <value> (and store the result in) <variable> | Multiplies two values, storing the result in the specified variable. |
SUB <value> <value> <variable> | SUB(tract) <value> (and) <value> (and store the result in) <variable> | Subtracts the second value from the first value, storing the result in the specified variable. |