esolang

BSQBL

Brainfuck Style Queue-Based Language. There is no pointer; every command works on the front of a queue.

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

Tested with 5 known programs · Test method

Run it

Expected: H

The idea

ChuckEsoteric08 swapped brainfuck's tape for a queue. A command takes the element at the front and puts what it makes at the back, so the queue turns one place with every + or -. Moving left or right becomes <, which takes the front element and puts it back unchanged, and > adds a new 0 at the back.

Read the story

To keep a value you have to put it back, and to test it you lose it. [ takes the front element to decide, so a loop usually copies its counter with " first.

The machine

CommandDoes
>Put a 0 at the back
+ -Take the front, put it back one higher or lower
<Take the front, put it back
"Take the front, put it back twice
,Put the code of an input character at the back
.Take the front and print it as a character
[Take the front; if it is 0, jump past the matching ]
]Jump back to the matching [

Elements are integers. The end of input gives 0, which is what stops the cat.

Example

The first makes a 7 and copies it into three.
Expected: Hello
Expected: 0

The first makes a 7 and copies it into three. The loop runs seven times. Each pass takes 1 from the counter, adds 9 to the other element and copies the counter for the next test, so 7 becomes 70. Two more <+ make 72, an H.

The cat copies each character with ", tests one copy and prints the other. The third is Blashyrkh's 44 character truth machine. The specification also has a 206 character Hello World by Blashyrkh.

Patterns it teaches

  • Turing tarpit: brainfuck's eight commands on a queue instead of a tape.

Further

Queue-based

Write your own in Run Convert a program from BSQBL

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run bsqbl -e ',"[.,"]' --input 'Hello'
shib manual bsqbl

Source

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

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

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