YATDEL
Yet another two-dimensional esoteric language. Pointers walk a grid with a stack each, split in two and step down into other files.
HecknTarnation · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
HecknTarnation made YATDEL, short for Yet Another Two-Dimensional Esoteric Language. A pointer starts at S and walks right, running one character per step. Every pointer has a stack of its own, and T splits off a new one. A program can be spread over several files, called abstracts. A pointer that goes down to the next abstract keeps its place and its way, so the files lie on top of each other like layers.
Read the story
Turns come in two rules. Rule 1 sends a pointer that goes left or right down, and one that goes up or down left. Rule 2 sends them up and right. C turns by rule 1 while the top of the stack is above 0 and by rule 2 otherwise, and it is the only test there is.
The machine
| Char | Does |
|---|---|
S | Start here, moving right |
E Q | End this pointer; end the program |
T t | Split; the new pointer goes on, the old one turns by rule 1 or 2 |
= | | Only move on |
< > ^ v | Point left, right, up or down |
\ / | Mirrors |
(text) #n# | Push the characters with the first on top; push a number |
p ! ~ | Pop; duplicate; make the top negative |
+ - * d % | Pop two and push the result |
I | Read a line, as a number when it is one, else as characters |
O o | Pop and print a character or a number |
C c | Turn by rule 1 if the top is above 0, else by rule 2; c the other way round |
@ | Pop x, y and a character and write it into the grid |
& ? | Push a number from 0 to 100; take a random way |
$ | Wait as many milliseconds as the top says |
' " | Go down one abstract, or as many as the top says |
An empty line starts the next abstract, as the specification shows its two files. The specification leaves some things open, and this implementation picks one way for each. Arithmetic takes the top as the left operand. C on an empty stack leaves the way as it is. $ does not wait, and & and ? draw from a fixed seed, so every run is the same. A pointer that walks off its grid is an error.
Example
The Hello World.
The Hello World. (Hello World) pushes eleven characters with H on top. The pointer then goes round a small loop. C sends it down while the top is above 0, and < and ^ bring it back up through O, which prints and pops. When the stack is empty, C lets it run on to the mirror, which turns it down onto E.
The Multi-File Hello World pushes the text in the first abstract and goes down to the second with '. There it lands on the row with the same loop.
Numbers go between two #. With 5 on top of 3, - gives 5 less 3.
T splits the pointer. The new one goes on to the right and the old one turns down by rule 1. Each pushes two letters, and they print in turns, the older pointer first.
Patterns it teaches
- Two-dimensional control flow: with grids stacked in layers and pointers that split.
- Stack machines: one stack for each pointer.
Further
See also
Two-dimensional languages
Stack-based
Write your own in Run Convert a program from YATDEL
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: yatdel.
Command line
shib run yatdel -e 'S(Hello World)=======>C==========\
O| E
^< 'shib manual yatdelSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/yatdel.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org