EsoChan
Be program. A story in greentext, and nothing happens until it begins.
SpaceByte, 2022 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
SpaceByte made EsoChan in July 2022, after the stories people tell on 4chan. Every command is a greentext line that starts with >, and every other line is a comment, so a program can carry its own narration.
Read the story
A story starts frozen. Nothing runs until the line > be program, and > freeze program stops it again until the next > be program. An if guards only the one command after it, so a longer branch freezes the story when the test goes the wrong way and thaws it at the end.
The machine
| Line | Does |
|---|---|
> be program | Start or thaw the story |
> freeze program | Freeze it; commands are passed over |
> view name | Highlight a variable, 0 when new |
> set it to n | Set the highlighted variable |
> go up n > go down n > go 0 | Add n, take n, or clear it |
> ask | Read a character's code into it |
> print string text | Print the text |
> print linebreak > print character | Print a line feed or the variable as a character |
> if n > ifnot n | Run the next command only if the variable is, or is not, n |
> goto n | Jump to command n, or to the value of the variable n |
Commands are numbered from 1, and the comment lines get no number. The truth machine needs that.
Example
The truth machine.
The truth machine. The two plain lines are comments. On 0 the ifnot 49 lets goto 10 run, and command 10 prints the 0 and ends the story. On 1 it loops on commands 8 and 9 forever.
The test program asks for a letter and freezes whichever branch does not apply.
Patterns it teaches
- Camouflage: a program reads as a greentext story.
Further
See also
Pseudonatural
Write your own in Run Convert a program from EsoChan
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: esochan.
Command line
shib run esochan -e '> be program
> view userInput
> print string Please input 0 or 1:
> print linebreak
> ask
Input of 0? => Jump to desinent line, which prints and terminates.
> ifnot 49
> goto 10
Input of 1? => Print input, and repeat infinitely.
> print character
> goto 8
> print character' --input '0'shib manual esochanSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/esochan.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org