Left Curly Brace Symbol
Its real name is {. A pointer walks a path of braces, and a digit picks what each } does.
Yes, 2022 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
The user Yes made it in 2022, as a first 2D language. Its esolangs.org title cannot hold the real name, which is a single {. The program pointer starts on a, heads right and follows a path drawn with {. On the way a digit sets an accumulator from 0 to 9, and each } runs the function the accumulator picks. The data sits on one tape of cells.
Read the story
The only decision is made where paths meet. Where a path branches off to the side, the pointer turns left when the cell under the data pointer is 0 and right otherwise. It never goes straight there.
The machine
Digit before } | Does |
|---|---|
0 | Nothing |
1 2 | Add 1 to the cell, or take 1 away |
3 4 | Move the data pointer left or right |
5 | Print the cell as a character |
6 | Set the accumulator to 0 |
7 | Read a character into the cell |
8 | Set the cell to 0 |
9 | End the program |
A program has to end with 9}. If the pointer runs off its path, the run stops with the error Unexpected EOF. The specification leaves some things open. In this implementation cells are bytes that wrap, the end of the input reads as 0, and the pointer leaves every a heading right, which the cat below needs.
Example
The Hello, World commits 1 seventy-one times, which makes a G, prints it, adds 1 and prints again.
The Hello, World commits 1 seventy-one times, which makes a G, prints it, adds 1 and prints again. A note in the specification guesses HI; the count gives GH.
The cat. On the first lap the cell is 0, so at the junction on the a row the pointer turns up, reads a character with 7}, prints it with 5} and goes round to a. On the second lap the cell holds the character, so the pointer turns down to 9}. The cat prints one character.
Patterns it teaches
- Two-dimensional control flow: the only branch is a fork in the path.
See also
Two-dimensional languages
Write your own in Run Convert a program from Left Curly Brace Symbol
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: left-curly-brace-symbol.
Command line
shib run left-curly-brace-symbol -e 'a9}'shib manual left-curly-brace-symbolSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/left-curly-brace-symbol.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org