It is best to start with an example:
`$` denotes the start of a "template", what is used to match with the input. The template ends when the a line does not start with `$`. Thus the above template is:
`S` is the search keyword, searching the input with `4` as the argument. More on searches later.
`P` prints the result.
What one can do with templates
You can mirror them with the `M` keyword:
You can rotate them with the `R` keyword, where the argument is the number of rotations:
You can append them to each other with `<`, `>`, `v`, and `^`. `v` and `^` are vertical, while `>` and `<` or horizontal. Remember, it points to the one that goes first!
You can multiply vertically with `*` or horizontally with `~`:
One can assign templates (and other stuff) to variables by following the template with an **unused** non keyword variable name. All lowercase letters (except `v`) should be available. Note: these are effectively immutable, and cannot be reassigned a different template/value.
You can search with them using the `S` keyword. This is probably the most important function in the whole language.
If the argument following is < 4, then it searches until it finds a match and returns the match.
If the argument is divisible by 2, then it searches regardless of rotation.
The `S` command returns either an array of matches, or a single match.
Arrays or anything with indexes
Elements can be accessed with the `G` command, followed by the element index.
The length of an array can be acquired with the 'L' keyword.
Searches can be linked together with the `&` keyword.
There are only integers (in the code at least), and if you haven't noticed already, you can't put multi-digit numbers in the code.
Instead you can use `(...)`, which works like regular parentheses.
You can use `+` (addition), `-` (subtraction), `*` (multiplication), `/` (division, non-integer), `%` (modulus), and `^` (exponentiation).
If you should want to get the input as an array of lines, you're in luck! It is already in variable `I`.
Reserved letters in templates
`D` is any digit [0-9]
`*` is anything. Literally. It doesn't even have to exist. Think of it like a hole in the template.
`L` is any letter [a-zA-Z]
`l` is any lowercase letter [a-z]
`U` is any uppercase letter [A-Z]
`%` is the edge of a template, so `$%abc` would only match if `a` is on the left side of the input
You can escape these with a backslash `\`
There are (limited) character classes!
[abcd] is a or b or c or d.
[^abcd] is not a and not b and not c and not d.