This page serves to give users the syntax and instruction set for Legacy SIMAS implementations, such as SIMASJS v2.
"Legacy implementation" means syntax and instructions that are not necessarily in line with the modern SIMAS specification. This does not mean the syntax is wrong per se, but does not align with how the current specifications work.
Legacy syntax is often more verbose, requiring manual typings of almost all operations (when they interact with variables).
Legacy syntax is still valid syntax, though not all implementations may support it. If you are making a new implementation, it is reccomended to use the standard syntax.
- alias: +
- add the value of OPERAND 2 and 3 (as of now can only handle
num) the value will be assigned to OPERAND 2, if it is a variable name - OPERAND 1: the data type of both OPERAND 2 and 3
- OPERAND 2: the first addend, optionally being a variable name
- OPERAND 3: the second addend, optionally being a variable name
- alias: &&
- performs logical operation AND on OPERAND 2 and 3; the value will be assigned to OPERAND 2, if it is a variable name
- OPERAND 1: the data type of both OPERAND 2 and 3 (as of now can only handle
bool) - OPERAND 2: the first boolean variable, optionally being a variable name
- OPERAND 3: the second boolean variable, optionally being a variable name
- call the function
- OPERAND 1: the name of the function
- OPERAND 2 and all even numbered operands beyond that: can only be either
v,c,lorbwhich specifies the mode of the argument.vis followed by a variable name,cis followed by anumconstant,lis followed by the name of a list, whilebis followed by aboolconstant. - OPERAND 3 and all odd numbered operands beyond that: value of the argument
- Convert to a different data type
- OPERAND 1: name of variable
- OPERAND 2: target data type
- copy a variable's value to another
- OPERAND 1: the name of the variable copying from
- OPERAND 2: the name of the variable copying to
- alias: /
- performs operation of OPERAND 2 divide OPERAND 3 (as of now can only handle num) the value will be assigned to OPERAND 2, if it is a variable name
- OPERAND 1: the data type of both OPERAND 2 and 3
- OPERAND 2: the dividend, optionally being a variable name
- OPERAND 3: the divisor, optionally being a variable name
- marking the end of a function, conditional, or loop
- OPERAND 1: as of now can only handle functions, so the only possible value is
fun
- equal to comparison operator. value will be assigned to the variable at OPERAND 1, if it is a variable name
- ATTENTION: please use this ONLY when OPERAND 2 is a variable name and OPERAND 3 is a constant
- OPERAND 1: data type of OPERANDS 2 and 3
- OPERAND 2: name of first variable
- OPERAND 3: a constant
- equal to comparison operator. value will be assigned to the variable at OPERAND 1, if it is a variable name
- ATTENTION: please use this ONLY whend dealing with two variables
- OPERAND 1: data type of OPERANDS 2 and 3
- OPERAND 2: name of first variable
- OPERAND 3: name of second variable
- define a function
- OPERAND 1: name of the function
- OPERAND 2: number of parameters the function would accept
- alias: >
- greater than comparison operator. value will be assigned to the variable at OPERAND 2, if it is a variable name
- OPERAND 1: the data type of both OPERAND 2 and 3
- OPERAND 2: the first value, optionally being a variable name
- OPERAND 3: the second value, optionally being a variable name
- alias: >=
- greater than or equal to comparison operator. value will be assigned to the variable at OPERAND 2, if it is a variable name
- OPERAND 1: the data type of both OPERAND 2 and 3
- OPERAND 2: the first value, optionally being a variable name
- OPERAND 3: the second value, optionally being a variable name
- execute the contents of another .simas file
- OPERAND 1: path to the file
- jump to a label. this is an unconditional jump
- OPERAND 1: name of the label
- jump to a label. this is a conditional jump
- OPERAND 1: name of the label
- OPERAND 2: name of a variable. if true, will jump to the label
- define a label
- labels MUST be defined in a line prior to the line in which it is used
- OPERAND 1: name of the label
- list operations. lists are a special data structure that allows you to have multiple values in a single container.
- OPERAND 1: type of operation
- OPERAND 2: name of the list
- All of the list operations:
list new- creates a new list
list appv- append a variable to a list
- OPERAND 3: data type of the variable
- OPERAND 4: name of the variable
list appc- append a constant to a list
- OPERAND 3: data type of the constant
- OPERNAD 4: the constant
list upv- update the list item at a specific index with a variable
- OPERAND 3: the index, starting from 1
- OPERAND 4: the data type of the variable
- OPERAND 4: name of the variable
list upc- update the list item at a specific index with a constant
- OPERAND 3: the index, starting from 1
- OPERAND 4: the data type of the constant
- OPERAND 4: the constant
list del- delete an item from the list
- OPERAND 3: the index of the item, starting from 1
list acc- access an item from a list and store it in a variable
- OPERAND 3: the index, starting from 1
- OPERAND 4: the name of the variable that you want to store the value in.
list show- print out the entire list to the standard output
list dump- writes a list to a file
- OPERAND 3: file name
list load- loads a list from a file
- OPERAND 3: file name
- alias: *
- performs operation of OPERAND 2 multiply OPERAND 3 (as of now can only handle num) the value will be assigned to OPERAND 2, if it is a variable name
- OPERAND 1: the data type of both OPERAND 2 and 3
- OPERAND 2: the first factor, optionally being a variable name
- OPERAND 3: the second factor, optionally being a variable name
- not equal to comparison operator. value will be assigned to the variable at OPERAND 2, if it is a variable name
- ATTENTION: please use this ONLY when OPERAND 2 is a variable name and OPERAND 3 is a constant
- OPERAND 1: data type of OPERANDS 2 and 3
- OPERAND 2: name of first variable
- OPERAND 3: a constant
- not equal to comparison operator. value will be assigned to the variable at OPERAND 2, if it is a variable name
- ATTENTION: please use this ONLY whend dealing with two variables
- OPERAND 1: data type of OPERANDS 2 and 3
- OPERAND 2: name of first variable
- OPERAND 3: name of second variable
- alias: !
- negation logical operator
- OPERAND 1: name of the variable to be negated
- alias: ||
- performs logical operation OR on OPERAND 2 and 3; the value will be assigned to OPERAND 2, if it is a variable name
- OPERAND 1: the data type of both OPERAND 2 and 3 (as of now can only handle
bool) - OPERAND 2: the first boolean variable, optionally being a variable name
- OPERAND 3: the second boolean variable, optionally being a variable name
- print something to the console.
- OPERAND 1: The name of the variable which the information is stored
- print a constant to the console.
- OPERAND 1: The constant being printed
- print a new line
- print a space
- quits the program
- read from a file
- OPERAND 1: path to the file
- OPERAND 2: name of a variable to store the data of the file in
- signal the end of the execution of function. IT IS VERY IMPORTANT to include this at the end of every function(before
end fun;) because otherwise the function will be stuck in an infinite loop - OPERAND 1: optional, but should be used when the function has a return value. put
vif OPERAND 2 is a variable name,cif it astrornumconstant,lif it is a list, andbif it is aboolconstant - OPERAND 2: optional, but required if operand 1 is present. this operand specifies the return value. note: the return value will be stored in a variable called
$functionName. For example, the return value for a function likeaddThreewould be stored in a variable called$addThree.
- make a server that hosts a static website. This instruction is SIMASJS specific.
- OPERAND 1: path to the directory containing static website files
- OPERAND 2: port number
- assign a value to a variable.
- OPERAND 1: the type of value. If the operand here is "in", then the value of the user input will be stored at this variable, with
strtype - OPERAND 2: the name of the variable
- OPERAND 3: the value you wish to assign
- alias: <
- smaller than comparison operator. value will be assigned to the variable at OPERAND 2, if it is a variable name
- OPERAND 1: the data type of both OPERAND 2 and 3
- OPERAND 2: the first value, optionally being a variable name
- OPERAND 3: the second value, optionally being a variable name
- alias: <=
- smaller than or equal to comparison operator. value will be assigned to the variable at OPERAND 2, if it is a variable name
- OPERAND 1: the data type of both OPERAND 2 and 3
- OPERAND 2: the first value, optionally being a variable name
- OPERAND 3: the second value, optionally being a variable name
- alias: -
- performs operation of OPERAND 2 minus OPERAND 3 (as of now can only handle num) the value will be assigned to OPERAND 2, if it is a variable name
- OPERAND 1: the data type of both OPERAND 2 and 3
- OPERAND 2: the subtrahend, optionally being a variable name
- OPERAND 3: the minuend, optionally being a variable name
- get the type of a variable
- OPERAND 1: the variable name
- OPERAND 2: the type of OPERAND 1 will be assigned to this variable as a string
- write to a file after erasing all of its contents
- OPERAND 1: path of the file
- OPERAND 2: text to write
- write to a file after erasing all of its contents. same as
writebut writing variables - OPREAND 1: path of the file
- OPERAND 2: name of the variable whose contents will be written to the file.