esolang

Rrr

A Turing machine in two letters. Everything that is not R or r is a comment.

Ttulka, 2023 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 9 known programs · Test method

Run it

Expected: X

The idea

Ttulka made Rrr in 2023. A program is the table of a Turing machine, written as unary numbers in r with a single R between them. Every five numbers make one rule, and the interpreter is a universal Turing machine that reads the rules and runs them. All other characters are ignored, so a program can hide inside ordinary text.

The machine

Each rule is five numbers.

NumberMeans
1The state it applies in, r being the first state
2The symbol it reads, r being the blank
3The symbol it writes
4r to move left, rr to move right
5The next state

The machine starts in state r on the first cell of its input. When no rule fits the state and the symbol under the head, it halts and the tape is the output, a blank inside shown as a space.

The specification passes the tape alphabet to the interpreter apart from the program. It is the first line of the input, the symbols after the blank, one character each. The rest of the input is the tape.

Example

The 1-state busy beaver.

The 1-state busy beaver. In state r on a blank it writes rr, which is X, moves right and goes to state rr, which has no rules.

Nearly the same rule hidden in prose, as in the specification. The R and r in these lines spell rRrRrrRrrRrrr, so it goes to state rrr, which has no rules either.

Expected: X

The 2-state busy beaver leaves four X in six steps. The copier doubles its input, with ! as a marker.

Expected: XXXX
Expected: xxxxxx

The Hello World writes eleven cells and leaves the sixth blank.

Expected: Hello World

The palindrome test says it prints A for a palindrome and B otherwise. With the alphabet it gives, A then B, its machine writes B for a palindrome and A otherwise.

Patterns it teaches

Further

Cell-based

Write your own in Run Convert a program from Rrr

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: rrr.

Command line

shib run rrr -e 'rRrRrrRrrRrr' --input 'X'
shib manual rrr

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/rrr.js

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

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