The Brainf*ck Language

Posted by Sean Francis N. Ballais on July 30, 2015 01:51 PM

Programming languages were developed to ease the development of applications for computers. They ease development of projects, save time, and have a good return of investment. But there are languages designed to just f*ck with your brain. They want you to be mindblown by their rather peculiar syntax. A notable example, and also the highlight of this article, is Brainf*ck.


Brainf*ck was created in 1993 by Urban Miller, a Swiss physics student. He designed the language with being able to implement the smallest compiler possible. Impressively, the language is Turing-complete. The first compiler was coded in machine language which made it as small as 296 bytes. More compilers were developed and the size of many were much lower than 200 bytes, and one is, impressively, just 100 bytes.

Brainf*ck was not designed to be used for practical purposes, and was rather aimed to challenge and amuse programmers. The language uses a fairly simple machine model. The model consists of the program; an array consisting of 30,000 byte cells all initialized at zero, with a data pointer initialized to the point of the leftmost byte of the array; and two streams for input and output (using ASCII).

The language has a very minimal and simplistic syntax, with only eight commands.

Any character not included below is ignored and can be used for comments.

>    point to the next cell to the right
<    point to the next cell to the left
+    increment the value of the current cell by one
-    decrement the value of the current cell by one
.    display the value of the current cell
,    accept an input value, and store it in the current cell
[    if the value of the current cell is zero, skip to the instruction
     after the matching ] bracket. Otherwise, execute the instruction next
     to the bracket.
]    if the value of the current cell is zero, move to the next
     instruction. Otherwise, jump to the matching [ bracket.

Personally, I initially thought Brainf*ck was very confusing and felt that I won't ever touch it ever even once. That changed when it was during the Independence Day of my country. I wanted to say Happy Independence Day using a programming language. I wanted to challenge myself to create the greeting using an esolang. So, I settled with Brainf*ck with reasons I already forgot.

Grasping the concepts was fairly easy once you convert the weird, complicated descriptions of the commands to something fairly simple, or in layman's terms. The descriptions in the commands in the table above were simplified in layman's terms for the benefit of many.


After coding for less than an hour or two, I finally got Brainf*ck. My reaction was like of success kid's as pictured above. Here's even the code that I wrote in Brainf*ck for Independence Day.


This code has been unformatted so that it fits in a single line because the formatted code takes up sixty lines. If you want to see the formatted code, which is way more cleaner and beautiful, here is the link.

Using Brainf*ck was a satisfying experience. It was the closest thing I could get to programming with a machine language at the moment. The language takes away features you usually take for granted in languages like C, and Python. That taught me to appreciate the advances in programming languages that helped programmers create great products, and solve many of the world's problems.

What do you think of Brainf*ck? What's your opinion? Are you gonna try it to amuse your friends? Or are you just gonna pass it for now? Do you have a question to ask? Or do you need some clarifications? Let me know in the comments below.

comments powered by Disqus