esolang

Charred

Brainfuck with letters in the cells, and a goto by line number where the loops used to be.

SpaceByte, 2022 · Turing complete: with unbounded memory · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: Hello World

The idea

SpaceByte made Charred on 17 July 2022. Like brainfuck it has a tape of 30000 cells and a pointer, and + - < > work as they do there. A cell does not hold a byte. It holds one of 53 characters, space, then a to z, then A to Z, numbered 0 to 52. So . prints the character itself and ' prints its number.

Read the story

There are no loops. : runs the next command only when the cell is not 0, and / jumps to the line whose number is in the cell. A program loops by keeping line numbers in cells. With 30000 cells of 53 values esolangs.orgcalls it a bounded-storage machine.

The machine

CommandDoes
+ -Step to the next or the previous character
> <Move the pointer
. 'Print the cell's character, or its number
,Read a character into the cell
\Print a line break
:Run the next command only if the cell is not 0
/Go to the line whose number is in the cell
\|Clear the console

Every other character is ignored. Lines are numbered from 1.

Example

The Hello World.

The Hello World. H is 34 and e is 5, so the second line takes 29 away.

The counter prints X ten times. Cell 1 counts down from 10, and cells 2 and 3 hold the line numbers 8 and 5. On the last line : lets the first > run only while the counter is not 0. So / reads cell 3 and goes back to line 5, or reads cell 2 and goes to line 8, past the end.

Expected: XXXXXXXXXX

' prints the number in the cell, and X is 50.

Expected: 50X

Choices the specification leaves open. + past Z gives space and - below space gives Z. Past the end of the input , reads a space, and a character outside the 53 stops the run with an error. A jump to line 0 or past the last line ends the run. | empties everything printed so far, and moving off either end of the tape is an error.

Patterns it teaches

Further

Cell-based

Write your own in Run Convert a program from Charred

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run charred -e '++++++++++++++++++++++++++++++++++++++++++++++++++
>++++++++++
>++++++++
>+++++
<<
<.>-
:>>/'
shib manual charred

Source

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

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

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