Excellerated Short-Term Memory Loss
Excellerated Short-Term Memory Loss (or ESTML) is an esoteric programming language designed and implemented by User:PolySaken. Its goal is to facilitate the most spreadsheet-like program syntax possible.
Excellerated meaning 'made excel-like', in reference to microsoft excel's grid layout.
Overview
In ESTML, the program must be set out in a grid constructed like so:
GRID: +---------+--------+--+---------+ | | | | | +---------+--------+--+---------+ | | | | | +---------+--------+--+---------+
Each column can have its own width, however all cells must have the same width as their column. The
GRID:
Keyword is required for every grid, which a single program in ESTML may have many of. Grids can be named like so:
GRID: grid_a +---------+--------+ | | | +---------+--------+ GRID: grid_b +---------+--------+ | | | +---------+--------+
This is purely cosmetic and makes accurate error reporting easier.
Execution
ESTML Begins execution at the top-left cell in the grid, executing the instructions inside in reverse, and then moving to the cell to the right, if not otherwise instructed. At the time of writing, ESTML has these commands:
command | function | syntax example |
---|---|---|
> | Jump to the next cell to the right | N/A |
< | Jump to the next cell to the left | N/A |
v OR V | Jump to the cell below | N/A |
^ | Jump to the cell above | N/A |
- | Pop the top stack item and find the result of splitting it by '.', then jump to the cell at that location | -0.7 (jump to cell 0, 7) |
command | function | syntax example |
---|---|---|
P | Print the top value of the stack (no newline) | P 'hello world' |
G | Print all items of the stack | N/A |
B | Print a newline | N/A |
K | Push user input to the stack as a string | N/A |
N | Push user input to the stack as an int | N/A |
command | function | syntax example |
---|---|---|
$ | Pop the top stack item and find the result of splitting it by '.', get the value of the cell at that location and push it onto the stack | $2.0 (read cell 2,0) |
+ | Pop the top stack item and find the result of splitting it by '.', set the value of the cell at that location by popping another item | +2.0 1 (set cell 2,0 to 1) |
I | Take (without popping) the top item, if it evaluates to False, skip the next step | QI 1 (quits the program) QI 0 (skips Q) |
O | Pop the top item, then take (without popping) the next. If they are not equal, skip the next step. | QO 1 1 (quits the program) QO 1 2 (skips Q) |
Q | End the program | N/A |
A | Pop the top two items and add them if they are both numbers, or concatenate them to a string if not, then push the result | A 2 3 (pushes 5), A 'e' 1 (pushes 'e1') |
S | Pop the top two items and subtract the first from the second, then push the result | S 2 3 (pushes -1) |
M | Pop the top two items and multiply them, then push the result | M 2 3 (pushes 6) |
D | Pop the top two items and divide the second by the first, then push the result | D 3 2 (pushes 1.5) |
F | Swap the top two stack items | N/A |
R | Delete the top item of the stack | N/A |
L | Pop the top two stack items and get the character of the first item (assuming it's a string) at the position held by the second item (assuming it's an int) | L 'foobar' 3 (push 'b') |
J | Pop the top stack item (assuming it's a string), then reverse it and push it | J 'foobar' (push 'raboof') |
All commands are case-sensitive except for V, which is an arrow not a letter.
Additionally, any numbers will be pushed directly to the stack and strings enclosed in 'single quotes' will also be pushed.
Because each cell is run backwards, printing a string looks like:
P 'some string'
NOT
'some string' P
If the last cell in a row is reached and does not either redirect the program or quit, an error will be generated.
Memory
From this section is where ESTML derives the second part of its name. Each cell has a stack of 3 items, in which the bottom item is removed and the entire stack is pushed down whenever another is added. Once the program leaves the cell, the stack is cleared and the top item is saved in that cell. This gives the effect of a very temporary program memory, and forces the user to make use of many cells.
Error Reporting
In ESTML, the convention for error messages is as follows:
Error Type: small description, [grid name,] line number, cell number At: Describe where in the line the error occurred, OR snippet of actual line, with arrow below indicating error location
The official interpreter uses this format. The following error types exist in the official implementation:
Error Type | Display Name | Description |
---|---|---|
ShapeErr | Shape Error | Cell is missing '|' wall; Cell is too long/short; Separator line is too long/short or contains an invalid character |
SyntaxErr | Syntax Error | Cell contains invalid character |
ValErr | Value Error | Invalid operation performed (I.E. string*float); (OLD: User inputs a string to ''N'' command) |
PosErr | Position Error | Invalid jump location; Jump location off grid; Program not terminated |
FormErr | Format Error | Use of $ or - command on non-float |
Examples
Hello world program, this is a single-cell program:
GRID: +-----------------+ | P 'hello world!'| +-----------------+
However this program is not compliant with the 'correct' usage of ESTML, which would look like this:
GRID: +----------------+----------------+ | 'hello world!' | P $0.0 | +----------------+----------------+
This results in a more spreadsheet-like syntax. An interpreter may even enforce this, by raising an error if commands are found in a cell that contains a string literal.
(both of these examples would generate an error if executed, as the terminator Q is omitted for clarity.)
Truth machine:
GRID: +---+---+ |VIN|QP0| +---+---+ |P1 |< | +---+---+
- VIN means 'down if [Get Number] is not 0' (otherwise go right by default)
- QP0 means 'quit after printing 0'
- P1 means 'print 1' (and go right)
- < means 'jump left'
A simpler version:
GRID: +------+--+-+ |QP0>IN|P1|<| +------+--+-+
This version is considered inferior due to the lower readability and less spreadsheet-like appearance.
CAT Program:
GRID: +---+ |QPK| +---+
QPK (meaning 'quit after printing keyboard') will take user input, print it, then quit.
Computational Class
Because ESTML's memory is limited to the finite grid set out in each program, and there is no way to store an array, ESTML is a Linear Bounded Automata. Thus it is not turing complete.
ESTML can be made turing complete by simply allowing the $ and + commands to access arbitrary cells (I.E. cells not on the visible grid). The instruction pointer doesn't even need to access them. This makes it possible to implement brainfuck in ESTML, thus allowing ESTML to be made turing complete.