esolang

Symbolic Brainfuck

Brainfuck in old PC symbols, with eight named registers and cells that can hold an address.

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

Tested with 4 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: Hello, World!

The idea

Symbolic Brainfuck writes brainfuck with characters from the old PC code page, arrows, triangles and inverted punctuation, none of which a US keyboard can type. Then it adds what brainfuck lacks most. ² and ½ double and halve a cell, so 72 is ▲²²²▲²²² instead of 72 pluses. Eight registers, named by Greek letters, each swap with the cell. And ↨ and ⌂ turn a cell into a pointer. One stores the position, the other jumps to it.

Read the story

The hello world uses that for a jump table. Cell 0 holds 128 and cell 1 holds 256, and ←⌂⌂ gets from any loop back to the output area in two steps.

The machine

A tape of 160,000 cells of 32-bit integers, as the specification suggests, a pointer at cell 0 and eight registers.

CommandBrainfuckDoes
→ ←> <Move the pointer
▲ ▼+ -Add or subtract 1
¡ ¿. ,Print the cell as a character, read a byte
≤ ≥[ ]Loop while the cell is not 0
² ½Double, halve
↨Cell becomes the pointer's position
⌂Pointer moves to the position in the cell
α ß π σ µ δ φ εSwap the cell with that register

Moving off the tape stops the run. Every other character is a comment.

Example

TIO's hello world works by doubling and halving.
Expected: ba

TIO's hello world works by doubling and halving. ▲²²²▲²²² is 1, 8, 9, 72. The registers park the o and the comma for later. The second program reads a into register α, then prints b and swaps a back.

Patterns it teaches

  • Code as data: a cell can hold an address, so the tape can store its own jump table.
  • Turing tarpit: it contains brainfuck, so it is complete.

Further

Symbolic Brainfuck builds on Brainfuck.

Brainfuck

Brainfuck derivatives

Write your own in Run Convert a program from Symbolic Brainfuck

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run sbf -e '¿²¡' --input '!'
shib manual sbf

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/sbf.js

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

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