A work in progress esoteric language. Version: WD 1
The language has a meaning of data types. There are number data types, the only ones so far.
Numbers are signed integers which can go at least up to 255 (2^8 - 1).
They are denoted as N in instruction listings, though that can also denote any type at all.
Commands are characters or character combinations that start with one or more `x` characters and end with the same amount of characters, with the requirement that the first of these is not `x`.
Commands act on an infinite stack.
Commands are executed left-to-right.
Before a schas002’s Concise Language program is executed, it is first sanitized from non-code by removing these things in order.
Any construct that starts with `x[` and ends with `x]` is removed. (Blocks that encounter the start or end of the file don’t require a matching `x[` or `x]`.)
Any construct that starts with `x#` and goes up until the end of line is removed.
Any whitespace characters (any space, tab or newline) is removed.
If an invalid command is detected, it is just not executed, essentially becoming a no-op (NOP).
- Input N, an integer from standard input.
- Push N.
- Input a character from standard input. Let this be c.
- Push N, the character ordinal of c.
- Pop N, an integer.
- Output N to standard output.
- Pop N, an integer.
- Output the character corresponding to the ordinal N to standard output.
- Push 0.
- Pop N.
- Pop N.
- Push N2, N + 1.
- Pop N.
- Push N2, N - 1.
- Pop N, an integer.
- Pop N2, an integer.
- Push N3, N + N2.
- Pop N, an integer.
- Pop N2, an integer.
- Push N3, N - N2.
- Pop N, an integer.
- Pop N2, an integer.
- Push N3, N × N2.
- Pop N, an integer.
- Pop N2, an integer.
- Push N3, N ÷ N2 rounded down.
- Pop N, an integer.
- Pop N2, an integer.
- Push N3, N mod N2.
`%`, which is usually used in other programming languages for this operation, is already allocated for the swap operation in this language. `m` is used instead, which stands for modulo.
- Pop N, an integer.
- Pop N2, an integer.
- Push N3, N to the power of N2.
`^`, which is usually used in other programming languages for this operation, is already allocated for the pick operation in this language. `p` is used instead, which stands for power.
- Pop N.
- Push N two times.
This is also known as the dup operation, and is expressed in instruction listings as:
- Dup a.
- Pop N.
- Pop N2.
- Push N2.
- Push N.
This is also known as the swap operation.
- Move the top of stack to the bottom of stack.
This is also known as the roll operation, and it rolls the stack upwards.
- Dup N.
This is basically the dup operation applied on the second to top of stack, and is known as the pick operation.
Closes the nested structure currently going on.
Is a nested structure that runs if and only if the top of stack is nonzero. The top of stack is only peeked at.
Is a nested structure that loops while the top of stack is nonzero. The top of stack is only peeked at.
Halts execution of the program.