esolang

BRUH

Four capital letters. Three of them spell the commands, the fourth keeps them apart, and two of it start a comment.

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

Tested with 4 known programs · Test method

Run it

Expected: 7

The idea

BRUH dates from 2022. It is a brainfuck relative written in the letters of its name. Every command is three letters from B, R and U, and an H goes between commands. Everything that is not one of the four capitals is a comment, and so is text between HH and HH. The program ends with RHHB.

Read the story

Memory is a row of accumulators instead of a tape. There is only one at the start, and the program has to add more on either side before it can move.

The machine

CommandDoes
BBB BBRAdd 1, take 1
BBUSquare the accumulator
BUR BUUAdd an accumulator at the left or right end of the row
RBR RBUMove one accumulator right or left
UUU URUbrainfuck's [ and ]
UBRDo the command before it as many times as the accumulator says
RRBRead a number
RRU RBBPrint the accumulator as a character or as a number

HHH starts a comment over many lines. Numbers print as bare digits, and the end of the input reads as 0.

Example

The adder, with its comments.

The adder, with its comments. It adds a second accumulator, reads one number into each, then moves 1 from the left to the right until the left one is 0.

The truth machine. On 0 the loop is skipped and the last RBB prints 0. On 1 the loop prints 1 forever.

Expected: 0

UBR repeats. Three BBB make 3, and UBR does BBB three more times.

Expected: 6

Patterns it teaches

Further

Also in Turing tarpits

Write your own in Run Convert a program from BRUH

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run bruh -e 'RRBHUUUHRBBHURUHRBBHRHHB' --input '0'
shib manual bruh

Source

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

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

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