Excellerated Short-Term Memory Loss
A spreadsheet that forgets. Each cell has a stack of three, and keeps one value when the program moves on.
PolySaken, 2021 · Turing complete: no · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
PolySaken made Excellerated Short-Term Memory Loss, ESTML for short, in 2021, to look as much like a spreadsheet as a program can. The program is a table drawn in text, and the run walks from cell to cell, to the right unless a cell sends it elsewhere.
Read the story
Inside a cell the commands run backwards, from right to left. So P 'hi' pushes 'hi' and then prints it. Each cell gets a fresh stack of only three items, and a fourth push drops the bottom one. When the run leaves, the stack is wiped and only its top item stays behind as the cell's value. That is the short-term memory loss. Anything worth keeping has to sit in a cell and be read back with $.
The machine
| Command | Does |
|---|---|
> < v ^ | Go to the next cell that way, at once |
- | Pop a location like 2.0 and go to that cell |
P G B | Print the top; print the stack; print a line feed |
K N | Push a line of input as a string or as a whole number |
$ + | Pop a location; push that cell's value, or pop a value into it |
I | Skip the next command if the top is 0 or empty |
O | Pop the top; skip the next command if the item under it differs |
A S M D | Add (or join as text), subtract, multiply, divide |
F R L J | Swap; drop; take a character; reverse a string |
Q | End the program |
Numbers and 'strings' push themselves. A location 2.0 is column 2, row 0, counted from 0. Moving right off the end of a row is an error, so every program needs a Q.
Example
The truth machine.
The truth machine. VIN reads a number, and I skips the V when it is 0, so the run goes right to QP0, which prints 0 and quits. On 1 it goes down to P1 and bounces between P1 and < forever.
The cat quits after printing what it reads.
Cells as memory. The first cell keeps 6 and the second keeps 7 times 2. The third reads both back, adds them and prints 20.
The Hello World has no Q. It prints and then stops with an error, as the specification says it will.
Patterns it teaches
- Two-dimensional control flow: the run moves over a table of cells instead of a line of code.
- Stack machines: a stack of three that is wiped at every step.
See also
Pattern-based
Two-dimensional languages
Write your own in Run Convert a program from Excellerated Short-Term Memory Loss
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: excellerated-short-term-memory-loss.
Command line
shib run excellerated-short-term-memory-loss -e 'GRID:
+---+
|QPK|
+---+' --input 'Hello, cat!'shib manual excellerated-short-term-memory-lossSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/excellerated-short-term-memory-loss.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org