Arcane Programming Languages

Arcane Programming: Brainfuck

Justin Ohms
4 min readJun 1, 2023

Brainfuck is an intentionally minimalistic and complicated programming language that perfectly encapsulates the zeitgeist of the early 90s and the dawn of the very early internet.

“Hello World” in Brainfuck

The History of Brainfuck

When Urban Müller introduced Brainfuck in 1993 the internet wasn’t yet widely available to the public. Even for those of us that had internet, there wasn’t much that you would recognize today. This was the era of Gopher, FTP, and Telnet. The Mosaic web browser had only just been released a few months earlier in January and the “World Wide Web” was just a headline to get you to buy magazines. (Basically the 1990s version of click-bait.) Müller was seeking to develop the smallest compiler ever. His quest led him to invent Brainfuck. His compiler for the Amiga was only 240 bytes.

I do have a special affinity for Brainfuck. The Amiga was my first computer and Brainfuck was the first alternative language I played with. I downloaded it off of AmiNet (another creation of Müller’s) via a WWIV BBS shortly after it was released. Thinking about it, Brainfuck might be the 6th programming language I learned, right after Z80 assembly, Logo, Basic, Fortran, and C.

The design philosophy behind Brainfuck was simplicity — not in terms of understanding or using it — but in terms of its minimal syntax. It comprises only eight simple commands, a data pointer and an instruction pointer. Despite this minimalistic design, it is Turing complete. This means that given enough time and memory, it can theoretically compute anything that any modern programming language can.

Its cryptic and arcane nature makes Brainfuck more of a mental challenge among programmers rather than a practical language for software development. It’s the Rubik’s cube of programming languages — and like many other languages I will cover, you wouldn’t use it for any practical purpose. Instead, it’s a challenging mental exercise that helps sharpen your mind and problem-solving skills.

Syntax and Architecture

Brainfuck operates on an array of memory cells, each initially set to zero. It has a pointer, initially pointing at the first memory cell. The operations it supports can be summarized with eight commands, each of which is represented as a single character:

  • >: Increments the data pointer.
  • <: Decrements the data pointer.
  • +: Increments the byte at the data pointer.
  • -: Decrements the byte at the data pointer.
  • .: Outputs the byte at the data pointer.
  • ,: Accepts one byte of input, storing its value in the byte at the data pointer.
  • [: If the byte at the data pointer is zero, then it jumps forward to the corresponding ].
  • ]: If the byte at the data pointer is non-zero, then it jumps back to the corresponding [.

That’s it! Every Brainfuck program is a combination of these eight commands. The simplicity of the syntax is rather deceptive. Writing anything beyond the basic ‘Hello, World!’ program involves juggling these eight commands in mind-boggling ways.

The beauty and complexity of Brainfuck lie in the fact that, despite its primitive syntax, it can be used to create complex programs that involve input/output handling, loops, conditional execution, and arithmetic operations.

The Future of Brainfuck

The future of Brainfuck, in the conventional sense, may seem bleak. After all, we’re living in an age where programming languages are designed with the goal of increasing productivity and efficiency, rather than challenging the programmer’s mental acrobatics.

However, Brainfuck continues to hold a special place in the hearts of programming enthusiasts including myself, and has even spurred the creation of a whole genre of esoteric programming languages. The challenge of Brainfuck has given rise to numerous derivatives and spin-offs, each more complex than the last.

Brainfuck serves as a tool to help illustrate the concept of Turing completeness and the fundamental architecture of programming languages. Its very existence encourages us to explore the essence of computation and the limits of programming language design.

This article is just part of an ongoing series on Arcane and Esoteric programming languages. Follow me if you want to see more.

I write on a wide variety of topics including programming, travel, politics, books, and AI. You can see all of my stories on Medium here.

If you like my stories on Medium, you can subscribe here to get them directly in your inbox. That way you’ll never miss one!

You can also support other authors and me by joining the Medium community. Sign up for a membership using this link. For only $5 a month, you get unlimited access to all the stories on Medium and I also get a small commission at no extra cost to you.

(Some of the links in my articles may be affiliate links for which I might receive a small commission.)

--

--