esolang

PainLang

Brainfuck with one command fewer. To go back, you turn the whole machine around.

TeamLightning, 2021 · Turing complete: no · ●●○ moderate · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: A

The idea

TeamLightning wrote PainLang in 2021, out of boredom. It is brainfuck on 16 cells of one byte, with no command to move left and none to take 1 away. Instead a flips a negation bit, and while it is set o moves left and w counts down. Every step back costs two extra as.

Read the story

The index takes 4 bits, the negation bit 1 and the cells 128, so the whole memory is 133 bits. PainLang is a bounded storage machine, not Turing complete.

The machine

CommandDoes
oMove one cell right, or left when the bit is set, round the 16
wAdd 1 to the cell, or take 1 away when the bit is set, round the byte
aFlip the negation bit
! ?Print the cell as a character; read a byte into it
O ... WLoop while the cell is not 0, as [ ... ] do in brainfuck
AA comment to the end of the line

# prints debug information in debug mode, which is off. The specification's list of commands says o and w always add 1; its examples only work when both follow the bit.

Example

Eight times eight, plus one.

Eight times eight, plus one. Inside the loop, aowa steps back to the counter and counts it down.

The second example reads three digits and prints the character with that code. Its first three loops take 48 from each digit, and the long line adds the hundreds, tens and ones into the first cell.

Expected: A

The Hello World was written before loops existed. It builds the eight letters it needs one w at a time and walks back and forth between them.

Patterns it teaches

Further

PainLang builds on Brainfuck.

Brainfuck derivatives

Cell-based

Write your own in Run Convert a program from PainLang

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run painlang -e 'o?o?o?aoooa#
wwwwwwwwOoawwwwwwowaW
wwwwwwwwOooawwwwwwoowaW
wwwwwwwwOoooawwwwwwooowaW
oOaoawwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwoawaW#oOaooawwwwwwwwwwooawaW#oOaoooawoooawaW#
aoooa!' --input '065'
shib manual painlang

Source

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

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

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