esolang

BrainCurses

Brainfuck on a deque, written so that every program looks like #@!*&@^!.

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

Tested with 3 known programs · Test method

Run it

Expected: HELLO WORLD!

The idea

BrainCurses keeps brainfuck's loops but trades the tape for a deque and one variable, A. Only the top of the deque can be read or written, as on a stack, but ^ and # turn the whole deque one place, so the bottom item can come up to the top. The name comes from how the programs look, like the symbols that stand in for swearing in cartoons.

Read the story

The specification proves it Turing complete with a table that turns every boolfuck command into BrainCurses. The deque plays the tape, and turning it plays moving the head.

The machine

CommandDoes
! @Push A onto the deque; pop the top into A
^ #Move the top item to the bottom; move the bottom item to the top
+ -Add or take 1 from A
% * &Swap A and the top; set the top to A; copy the top into A
'nSet A to the character n
: _Print A as a number or as a character
;Read a character into A, 0 at the end
[ ... ]Loop while A is not 0
[$ ... ]Loop while the top of the deque is not 0

Example

The Hello World program pushes a 0 and then the letters, turns the 0 to the top, turns the H up after it,…

The Hello World program pushes a 0 and then the letters, turns the 0 to the top, turns the H up after it, and prints from there until the 0 comes round. The specification says it prints Hello World!, but every letter in it is a capital.

Expected: cat

The addition, !^^&#!^&#!@[-%+%]#@, adds the top two items and pushes the sum, leaving the rest of the deque as it was. The example adds 2 and 3, and @: prints the sum.

Expected: 5

Patterns it teaches

Further

BrainCurses builds on Brainfuck.

Deque-based

Brainfuck derivatives

Write your own in Run Convert a program from BrainCurses

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run braincurses -e ';[_;]' --input 'cat'
shib manual braincurses

Source

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

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

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