Commands Pt.1 - StackMeter/Anti-Alpha GitHub Wiki
Since I don't want to bring Unicode characters in before even deciding on the ASCII characters, the first commands here will be ASCII characters (in order of importance). (NB: list/set/tuple will be called ? from now on.)
Defines a string literal. This is one of the two places that ! is allowed (check the readme for the definition of !).
Ends any line of code, and anything after is treated as a comment. This is the other place that characters in ! can appear, and the ONLY other place that ! characters can appear. If you want them elsewhere, well, tough: go use another language.
Defines a literal number. That's it.
Each of these pairs of brackets do a whole lotta things. To list them all:
Defines things: ?(....)
for a if loop, $(....)
for a function, ?[...]
for a while loop and ?{...}
for a case statement.
Defines tuples: (...)
; lists: [...]
; and sets: {...}
Seperates statements in math: (...)*(...)+(...)
and many other syntax features.
Used in all conditional loops: seperates statements, and/or ends lines of code - as well as this, :
indexes into lists.
<
prompts input from STDIN - you can place a string directly after this, and then :
, to print a certain message, and >
prints a variable/message after it to STDOUT.
For the last entry, we have the assignment/equal to operator - it will be useful pretty much everywhere; for example ?(...==...), ?[...!=...], etc. By the way, ... is a valid variable name.
When used on a number: adds it to itself if it is the only argument provided, else adds its two arguments together.
When used on a string: concatenates the left string with the right string (if either of these parameters is empty, defaults to the empty string.
When used on ?: appends the value(s) to the list/set/tuple (will be casted to the correct type by the interpreter.
When used in a conditional: OR - ?(...+...)
When used on a number: subtracts it from itself if there is one number (useful to zero a variable in one byte, else subtract right from left)
When used on ? or a string: removes all instances of the right from the left - defaults to whitespace on a string.
When used on a number or ? - multiplies every element by the right number.
When used in a conditional: AND - for example ?(...*...)
Exponentiates a number or all elements of a ? member with the number on the right. Also, in a conditional: XOR: ?(...^...)
Modulos a number or ? with the right number.
Divides a number or ? by the right number.
Negates a number or ?. Unlike most of the operators, this is strictly unary. Also, in a conditional, NOT: ?(¬...)
Returns floor(left/right): if there is more than one number, does this for all elements in the list. Also, as I said before, this will split a string on another string, or a list on a list. However, it keeps the original numbers if it was a number on the right, and then floors them.
More of these will be introduced in the math library (when it comes out).
Defines a conditional loop (as stated in the bracket section) - must be followed by a conditional statement.
Defines a variable with the name placed after it: eg, @$%! = 13;$%!,
to print 169. Just about any two+-character name is valid, except for a rare subset of 3-char names (aka library functions).
Defines a function, with a name placed in-between the $
and the (
. Arguments to be passed to the function can be added with the :
and then the variable.
There are no go-to statements, but those will be in the next update (probably).
This is the end of the basic commands - keep an eye out for the Pt.2 and some advanced commands. Many of the ASCII characters not featured here (_
, ~
, ¦
, ,
, .
, ... wait there's only 5?) will be present in newer updates.