Brainfish

From Esolang
Jump to navigation Jump to search

Brainfish is a cross between Brainf*ck and Deadfish.

Commands

The brackets ([ and ]) from brainf*ck work the same, and the comma (,) and dot (.) from brainf*ck also work the same, and the < and >, but no other commands from brainf*ck work. Every command from Deadfish works, but on the cell at pointer.

An aperçu shall present all available facilities:

Command Description Provenance
[ If the current cell value equals 0, move past the matching ] brainf*ck
] If the current cell value does not equal 0, move past the matching [ brainf*ck
> Move the cell pointer one step to the right brainf*ck
< Move the cell pointer one step to the left brainf*ck
, Query the standard input for a character and store its ASCII code in the current cell brainf*ck
. Output the character whose ASCII code matches the current cell value brainf*ck
i Increment the current cell value Deadfish
d Decrement the current cell value Deadfish
s Square the current cell value Deadfish
o Output the current cell value in its verbatim numeric form Deadfish

Examples

Cat

This cat program queries the user for a character and prints its ASCII code:

,o

Infinite cat

An infinite cat program, the same terminates on a user input of the null character, assumes the following form:

i[,.]

hi

>>>iiiiiiiiii[<<<iiiii[>ii<d][d]>[d>i<]>>d]<iiii.i.

Interpreter

  • Common Lisp implementation of the Brainfish programming language.