YABALL

From Esolang
Jump to: navigation, search

YABALL is a language inspired by Brainfuck, invented by Jannis Harder in 2005. Its aim is to add a more obscure code flow to Brainfuck. YABALL has a 2-dimensional code flow and 2 different flow modes. It's an acronym for Yet Another Brainfuck A Like Language. By an impossible accident the name YABALL has the same pronounciation as the Polish word for a cheap apple wine.

Commands

Normal-mode commands:

Command Description
+ Increment the current cell.
- Decrement the current cell.
> Move to the next cell.
< Move to the previous cell.
[ If current cell is 0 nop, else go down.
] Go up and change to reverse-mode.
, Input to the current cell. (see Misc Input & Output)
. Output the current cell. (see Misc Input & Output)
? Change to reverse-mode.
^ Go up.
v Go down.
@ Quit the program. (Current cell is the exit code)

Reverse-mode commands:

Command Description
! Change to normal-mode.
9 Go up.
6 Go down.

All other commands are nop.

Modes

There are two different modes, which have their own command-set:

Normal-mode

The normal-mode is for calculations, input/output and code flow. In normal-mode the current command is executed and the program-pointer moves right. (E.g. + is: Increment the current cell and go right)

Note: ] switches in reverse-mode so it moves left and not right

Reverse-mode

The reverse-mode is for Loops and code flow. It acts like the normal-mode but moves left after the current command.

Code flow

The code filled with spaces, until all lines have the same length. If the program-pointer reaches the right end of a line, it wraps to the left of the next line. If the program-pointer reaches the left end of a line, it wraps to the right end of the previous line. The last line wraps to the first and reverse.

The use of mode switching and wrapping is a sign for good YABALL coding style.

Misc

Cell size

The cell size is 16 bit

Input & Output

Input returns -1 on EOF.

Output outputs a byte to stdout if the current cell is less than 256. If the current cell is less than 512, the value-256 is written to stderr. 512 closes stdout and 513 closes stderr. Values from 514 to 32767 inclusive are reserved for future extensions. Other values may be used for anything.

Examples

Cat (mode switching):

!,+[@
!-.]?

Cat (wrapping):

,+[@
 -v
^  .

Computational class

YABALL is Turing-complete as there are two ways converting a Brainfuck program into a YABALL program.

External resources