esolang

BrainCursion

Brainfuck without its brackets. Loops are jumps back to a mark, or back to the very start.

CakeProphet, 2007 · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: hi

The idea

CakeProphet sketched BrainCursion in a few seconds in 2007, with no plan to build it. Madk wrote an interpreter for it in 2010. It takes brainfuck's [ and ] away. In their place come two marks and three jumps. % goes back to the last (, @ goes on to the next ), and # skips the next command when the cell is not 0.

Read the story

A brainfuck loop becomes (#@body%). A loop inside a loop does not work that way, since % and @ only find the nearest mark. The specification gives a converter from any brainfuck program anyway. It never writes a (, so every % goes back to the start of the program, and a counter in a spare cell says how many ) to jump over to get back to the right place.

The machine

CommandDoes
+ - < > . ,As in brainfuck
( )Only mark a place
%Go back to the last (, or to the start if there is none
@Go on to the next ), or end the program if there is none
#Skip the next command if the cell is not 0

Every other character is a comment. The tape has 30,000 byte cells that wrap, and , gives 0 at the end of the input.

Example

Both are cats.
Expected: cat

Both are cats. The first fills the loop (#@SomeCode%) with .,, which prints a character and reads the next. When , gives 0, # lets @ run and the program jumps past the ) to its end. The second is what the specification's converter makes of the brainfuck cat ,[.,], 59 characters without a single (. A brainfuck Hello World with a loop inside a loop comes to 330 characters, and it prints Hello World! in 6,695 steps.

Patterns it teaches

  • Turing tarpit: brainfuck with jumps in place of loops.
  • Turing completeness: the converter shows the way, as long as cells can count to twice the number of loops.

Further

BrainCursion builds on Brainfuck.

Brainfuck derivatives

Cell-based

Write your own in Run Convert a program from BrainCursion

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run braincursion -e '(#@SomeCode%)'
shib manual braincursion

Source

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

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

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