Rotten
Every program prints itself, 13 letters along.
Turing complete: no · ●○○ easy · esolangs.org
Tested with 5 known programs · Test method
Run it
The idea
Rotten is a joke language with two kinds of program. A program like 5$text prints the text with every letter moved 5 places along the alphabet. Any other program counts as 13$ in front of itself, so it prints itself in ROT-13. Writing a Hello World means writing it in ROT-13 first.
Read the story
The specification also boasts that a sequence prints its own elements. A sequence is digits and commas, and ROT-13 leaves those alone.
The machine
| Program | Prints |
|---|---|
n$text | The text in ROT-n |
1,2,3 | The digits again, with a space after each comma |
| anything else | Itself in ROT-13 |
Inside the text \n is a line feed and \i is the next byte of input, or a 0 byte when the input is used up. The specification's interpreter is two short NodeJS functions and ends every output with a line feed. It leaves out the escapes, so this implementation adds them as the specification's text describes, before the rotation. That means input goes through ROT-13 too.
Example
The Hello World, in both of its forms.
The Hello World, in both of its forms.
The Fibonacci prints what it says. The interpreter's test for a sequence takes only one digit after each comma, so this program fails the test at 13 and is printed in ROT-13, which comes to the same thing. A sequence that passes the test gets its spaces filled in.
The cat reads five bytes. Since the rotation comes after the input is read, the cat turns letters into ROT-13. With 0$ in front it really is a cat.
Patterns it teaches
- Encoding tricks: the program is its output under a Caesar shift.
Further
See also
Also in Jokes
Write your own in Run Convert a program from Rotten
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: rotten.
Command line
shib run rotten -e '\i\i\i\i\i' --input '1, 2!'shib manual rottenSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/rotten.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org