Brainf ck

From Esolang
Jump to navigation Jump to search
The title of this article is not correct because of technical limitations. The correct title is actually Brainf*ck.

Brainf*ck is an esolang invented by User:None1. Its goal is to be an esolang that is named brainf*ck but different from brainfuck. Its programs look like brainfuck programs, but they're not.

Memory

It uses a stack, containing wrapping bytes.

Commands

Command Meaning
+ Return 1
- Return top of stack and pop
, Read input as ASCII and return
. Print top of stack as ASCII
>[xyz...]< Push and return the sum of x,y,z...
[CODE] While top of stack is nonempty and nonzero, do CODE, return 0

Computational class

While the bracket constructs recurse, they are not able to recurse within themselves. This means that the stack is the only unbounded data storage. Therefore, it describes pushdown automata.

Examples

Hello, World!

>[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<.>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<.>[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<.>[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<.>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<.>[++++++++++++++++++++++++++++++++++++++++++++]<.>[++++++++++++++++++++++++++++++++]<.>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<.>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<.>[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<.>[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<.>[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<.>[+++++++++++++++++++++++++++++++++]<.

Cat program

>[+]<[>[,]<.]

Truth machine

>[,]<.>[-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<[>[-++++++++++++++++++++++++++++++++++++++++++++++++]<.>[-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<]

A+B Problem

>[,,,++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<>[.]<

Only supports adding one-digit numbers, numbers have to be separated by exactly one space:

Input: 1 2
Output: 3

External Resources

See also