esolang

YABALL

Yet Another Brainfuck A Like Language. Brainfuck's tape, run along lines that wrap into each other, with a second mode that walks backwards.

Jannis Harder, 2005 · Turing complete: yes · ●●○ moderate · esolangs.org

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

Run it

Expected: JA

The idea

Jannis Harder made YABALL in 2005 to give brainfuck a stranger flow of control. There are no loops that jump to a matching bracket. Instead the program is a page of lines, and the pointer moves up, down, right and left across it.

Read the story

In normal mode every command runs and the pointer then steps right. In reverse mode the pointer steps left and ignores almost everything. A loop is a trip down a line, back along it in reverse and up again.

The machine

A tape of 16-bit signed cells with no end. The lines are padded with spaces to one width. Running off the right end of a line lands on the start of the next one, and the last line leads back to the first.

Normal modeDoes
+ - > <As in brainfuck
.Write the cell as a byte, if it is 0 to 255
,Read a byte; -1 at the end of the input
[Go down a line if the cell is not 0
]Go up a line and switch to reverse mode
?Switch to reverse mode
^ vGo up, go down
@Stop
Reverse modeDoes
!Switch to normal mode
9 6Go up, go down

A vertical move keeps the column, and then the usual step right or left follows. Every other character does nothing.

Example

The first adds 74 and prints J, then takes 9 off for A.
Expected: mode switch
Expected: wrapping

The first adds 74 and prints J, then takes 9 off for A. The other two are the cat programs from the specification. In the first cat, [ drops to the second line and lands on ?. Reverse mode carries the pointer left to !, normal mode runs -. and ] sends it back up in reverse to the ! at the start. At the end of the input , gives -1, + makes it 0 and [ lets the pointer through to @.

Further

Ideas it shows

YABALL builds on Brainfuck.

Two-dimensional languages

Brainfuck derivatives

Write your own in Run Convert a program from YABALL

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run yaball -e '!,+[@
!-.]?' --input 'mode switch'
shib manual yaball

Source

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

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

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