ARCANE PROGRAMMING LANGUAGES

Arcane Programming: Malbolge

Justin Ohms
3 min readJun 26, 2023

My journey into the world of esoteric programming languages has taken a turn for the downright infernal this week, as I ventured into the depths of hell that is Malbolge.

“Hello World” in Malbolge

The History of Malbolge

Malbolge as first conceived by Ben Olmstead in 1998, takes its name from the eighth circle of hell in Dante’s Inferno. From my experience, it certainly lives up to its namesake.

Created to be nearly impossible to use, Malbolge was designed with a slew of counter-intuitive design decisions, a ‘crazy operation’, base-three arithmetic, and self-altering code. Its creation was meant to one-up the difficulty of other challenging esoteric languages, such as Brainfuck and Befunge.

I was not really surprised to discover that it took two years for the first Malbolge program to be written. This is the first language that I didn’t get any further than just copying and pasting the Hello World program above. The first program was not even written by a human it was generated by a beam search algorithm designed by Andrew Cooke and implemented in Lisp. Even Ben Olmstead himself has never written a Malbolge program!

Syntax and Architecture

Malbolge, is described as a machine language for a ternary virtual machine. It is unlike anything you will ever experience. With its three registers — a, c, and d — each serving distinct functions, it took me a while to even start to understand and I never really even did understand what I was doing.

The language’s memory is another mind-boggler, with 59,049 memory locations, each capable of holding a ten-trit ternary number. Yes, that really is as confusing as it sounds so if you have to read that again to understand it I completely understand. This use of shared memory space for both data and instructions was inspired by hardware such as x86 architecture.

What is truly nuts about Malbolge is the ‘crazy operation’ and the concept of self-altering code. After each instruction is executed, it is encrypted, effectively altering the instructions of the program as it is running. Yeah, you read that right. After each instruction is executed, that code is then encrypted which alters it.

The Future of Malbolge

While the original Malbolge is not Turing-complete, various versions, such as Malbolge Unshackled and Malbolge20, have been designed to overcome this limitation. These versions could maybe find niche uses in theoretical computer science or even in certain forms of software protection through obfuscation.

Given the extreme difficulty and unusual nature of Malbolge, one might wonder if it has any future. It is, after all, nearly unusable. And I would have to agree with that assessment.

My time spent trying and failing to program in Malbolge was an excruciating exploration of what a programming language can be. It does make you appreciate the simplicity and clarity of more conventional languages. In reality, this language is completely unusable. So much so that I really cannot recommend anyone even attempt to play with it. I mean unless you are some sort of masochist.

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.)

--

--