The true meaning of esoteric programming languages

Be it managing a developer team or being an ethical hacker, once you start digging deeper into the aspects of programming that don’t directly involve creating commercial software, you will encounter a whole universe of things even more obscure to uninitiated than programming itself. Why on earth create a programming language not intended for practical use? Or spend days writing code visually shaped as a quick brown fox jumping over a lazy dog?

“He’s sloppily clothed, uses unfamiliar jargon, he’s staring at the screen all day, and he earns four times as much as I. He must be a warlock,” – that’s what non-techies secretly think of computer people so far. Even the words “nerd” and “geek” widely used as a reference to those familiar with Java or Python, point out to how bizarre coders look to the collective unconscious. Despite the fact that nowadays literally anyone can learn to code, professional programmers are still envisioned the bearers of secret knowledge.

Once upon a time

This attitude probably goes back to the good old days of early programmers. In the apt words of John Backus, developer of FORTRAN, in 1950s many programmers “began to regard themselves as members of a priesthood guarding skills and mysteries far too complex for ordinary mortals.” And not without a reason. It was only later that languages like FORTRAN opened up the world of coding to people who were not trained in the field. And even more late that online learning resources, like Codeacademy, have welcomed all comers to learn basics of coding. Back then, this knowledge wasn’t widely available, and those able to communicate with the computer were considered, in a way, masters of “black art”.

Things have changed. Mainstream programming has followed the path of reducing complexity, where high-level languages are covering the low-level activity in the name of safety and ease. Millions of people got involved into coding. A computer science degree ceased to be the mandatory requirement for those applying for a programming job. But as opposed to mainstream trends, the alternative coding practices have appeared, countering this general “desacralization” of computer knowledge. Designed and practiced by a small yet dedicated community of “adepts”, they are intended to stretch the boundaries of programming beyond its strictly practical use. In a way, they recreate the sense of code as a “black art”, an esoteric knowledge, calling back to what programming was like in the days of machine code.

This is particularly true of alternative programming languages, known as esoteric programming languages, or esolangs. Unlike the “normal” languages, they are not intended for practical use, rather offering the exploration of language design itself. They bypass the niceties of mainstream languages, offering unique means of communication with the machine. This is where programming appears in its most abstract form, welcoming those curious-minded to grasp it more like an art rather than skill.

Here are some esoteric programming languages that have become classics in their field.

INTERCAL

Considered the first esolang ever, INTERCAL was inspired by the ambition to create a compiler language that has nothing in common with any other language. Created in 1972 by the combined efforts of two Princeton University students, it abstains from conventional operations, sharing only the basic elements such as variables, arrays, and the ability to do I/O. The syntax of common operations in INTERCAL is deliberately obscure and redundant. Even the instructions in INTERCAL documentation are somewhat ridiculous.

Caution! Under no circumstances confuse the mesh with the interleave operator, except under confusing circumstances!

The INTERCAL Programming Language Reference Manual

INTERCAL has a whole lot of features intended to make it unappealing as possible to a programmer. This includes using statements like "IGNORE" and "FORGET", along with the "PLEASE" modifier, which is, probably, INTERCAL’s most frequently mentioned feature. Both underusing and overusing this keyword leads to the program being rejected by the compiler. If “PLEASE” doesn’t appear often enough, the error message indicates that the program is insufficiently polite while too many “PLEASE” modifiers lead to program’s rejection because of its overly-politeness.

In point of fact, INTERCAL is a parody, satirizing aspects of the various programming languages at the time. By the way, its full name is “Compiler Language With No Pronounceable Acronym”, abbreviated to INTERCAL …well, for obvious reasons.

INTERCAL sample code

Brainfuck

While INTERCAL is the first esolang invented, brainfuck (its name is traditionally not capitalized except at the start of a sentence) may be considered the first regarding popularity. Remarkable for its extreme minimalism, this language consists of only eight commands: + – > < . , [ ] and can be implemented with the smallest possible compiler. Some brainfuck compilers are smaller than 200 bytes.

True to its name, brainfuck gives an immediate headache to a coder, requiring a long sequence of commands even for the mildly complex task. A program written in brainfuck inevitably gets very long or complicated. Nonetheless, the language is totally Turing-complete, and could, in theory, compute any computable function, if given access to an unlimited amount of memory. Although too difficult to write in for practical use, brainfuck keeps amusing and challenging programmers for the past two decades, having reached almost a cult following among esolangers.

As crazy as brainfuck looks, it forces one to deal with memory cells directly; much of the delight of the language is in this engagement with the machine which is obscured by the safety of high level code and the “humble” approach of reducing complexity.

Daniel Temkin, The Less Humble Programmer

Brainfuck sample code

Malbolge

As challenging as brainfuck is, it implies difficulty as merely the consequence of its minimalistic approach, while Malbolge was specially designed to be almost impossible to use. Named after the eighth circle of hell in Dante's Inferno, it takes the difficulty to the extreme, trying to be as counter-intuitive as possible.

For example, the effect of any instruction depends on where it is located in memory (mod 94, of course), all instructions are self-modifying (according to a permutation table) and both the code and data pointers are incremented after every instruction, making it hard to re-use any code or data.

Low Sheffer, Introduction to Malbolge

Malbolg is so extremely difficult to understand that it was not earlier than two years after its creation when the first Malbolg program appeared. And that one wasn’t even created by a human being: its “author” was a beam search algorithm, implemented in Lisp. For many years, the most complex known programs in Malbolge was 'hello, world', available in several versions. The author of Malbolge himself has never written a single Malbolge program.

The day that someone writes, in Malbolge, a program that simply copies its input to it's output, is the day my hair spontaneously turns green. It's the day that elephants are purple and camels fly, and a cow can fit through a needle's eye.

Ryan Kusnery's Wierd Languages Page

In 2004, Low Sheffers wrote a program that copied input to output, based on his approach of treating the language as a cryptanalysis problem. His program though did not terminate properly on end of input. The task was completed for real only in 2005 by a group of Japanese programmers that created the first correct "99 bottles of beer" program.

Now, 17 years after its creation, Malbolge remains the most difficult language to code.

Malbolge sample code

Whitespace

While the majority of programming languages ignores whitespace characters, Whitespace does the exact opposite. In Whitespace, only spaces, tab stops, and linefeeds are syntactically significant; everything non-whitespace is simply ignored by the interpreter.

A curious consequence is that the Whitespace program can be easily embedded into another program, written in another language, making the code a polyglot. That won’t work for languages where spaces are important for syntax validity, such as Python, but in most cases, whitespace characters could make up a totally valid Whitespace code.

Whitespace sample code

***

Esoteric programming languages intentionally refuse following the common ways of simplifying the complexity and clarifying the obscurity. Instead, they are offering a challenge of breaking new ground within deliberately obscure rules. Considering time and efforts it takes to code in esolangs, they may be regarded, in a sense, a bastion, guarding “the sacred territory” of programming from the uninitiated. Being mostly of no practical use, they offer a new level of engagement with the machine - the delight that not everyone is able to appreciate.