BSQBL

From Esolang
Jump to navigation Jump to search

BSQBL(Brainfuck Style Queue-Based Language) is an esolang by User:ChuckEsoteric08

Specification

Command Description
> Enqueue a new zero element
+ Dequeue the front element, increment it, and enqueue it
- Dequeue the front element, decrement it, and enqueue it
< Dequeue the front element and enqueue it
" Dequeue the front element and enqueue it two times
, Query the user for a character and enqueue its character code
. Dequeue the front element and output the character with the corresponding character code
[ Dequeue the front element; if it equals zero, jump past the matching ]
] Jump back to the matching [

Examples

Cat

,"[.,"]

Output "H"

>+++++++""[-+<+<+<+<+<+<+<+<+"<]<+<+<.

Truth-machine

This program operates a truth-machine:

,".><+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<"<
[--"<]
<["+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<.><+<]

Algorithms

This section is inspired by brainfuck algorithms. They don't use < directly and use variable names on top of command to denote current queue element.

x = 0

x x x x x
" [ - " ]

x = y using temporary element t

t t t t t x x x x x y y x t y y y t t y t t t
" [ - " ] " [ - " ] " [ + + - " ] " [ + - " ]

x = x + y using temporary element t

t t t t t y y x t y y y t t y t t t
" [ - " ] " [ + + - " ] " [ + - " ]

x = x - y using temporary element t

t t t t t y y x t y y y t t y t t t
" [ - " ] " [ - + - " ] " [ + - " ]

Interpreter

  • Common Lisp implementation of the BSQBL programming language.

See also

  • CQfuck - like brainfuck but uses call queue
  • MNNBFSL - uses two stacks instead of queue