esolang

退!退!退!

Chicken again, with every chicken replaced by 退!, "retreat!".

2024 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 7 known programs · Test method

Run it

Expected: 退!

The idea

The specification says it plainly. The program is only 退!, everything else is annotation, and the commands are the same as Chicken. The number of 退! on a line is the instruction, and one 退! pushes the text 退!. The specification gives its own interpreter in JavaScript, 77 lines long, and this implementation runs the way it does.

Read the story

So a program of one line with one 退! pushes 退! and ends, which prints the top of the stack. That is the quine.

The machine

退! on a lineDoes
0Exit and print the top of the stack
1Push the text 退!
2Add two values; text joins
3, 4Subtract, multiply
5Push whether the two top values are equal
6Load. The next line picks the source, 0 the stack or 1 the input; the top is the index
7Pop an address and a value, and store the value there
8Pop an offset and a condition; jump if the condition holds
9Turn a number n into the text &#n;
10 and upPush the count minus 10

Cell 0 is empty and cell 1 holds the input. Then come the lines, one cell each, and a 0 to end them. The working stack grows above that. At the end every &#n; in the printed text becomes the character with code n, which is how 9 makes letters.

Example

The A+B program adds two digits.

The A+B program adds two digits. Ten 退! push 0, six load, and the line of one 退! after it picks the input, so the first character of the input is loaded. Taking 0 away turns the text 3 into the number 3. The same is done with character 2, and the last line adds the two.

Expected: 7

The Hello World has 61 lines, 7 of them empty, and prints Hello world. An empty line is 0, and after a load it picks the stack as the source. The 99 program reads a number and counts down, 3 退!s, 2 退!s, 1 退!, and then prints 5o 退!s where the song would say No. The Deadfish interpreter has 139 lines and reads Deadfish from the input; on iissiso it prints 289 .

Patterns it teaches

Further

Stack-based

Write your own in Run Convert a program from 退!退!退!

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: u9000-ff01-9000-ff01-9000-ff01.

Command line

shib run u9000-ff01-9000-ff01-9000-ff01 -e '退!'
shib manual u9000-ff01-9000-ff01-9000-ff01

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/u9000-ff01-9000-ff01-9000-ff01.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org