Strange Computer Languages: A Hacker’s Field Guide

Why do we build radios or clocks when you can buy them? Why do we make LEDs blink for no apparent purpose? Why do we try to squeeze one extra frame out of our video cards? We don’t know why, but we do. That might be the same attitude most people would have when learning about esolangs — esoteric programming languages — we don’t know why people create them or use them, but they do.

We aren’t talking about mainstream languages that annoy people like Lisp, Forth, or VBA. We aren’t talking about older languages that seem cryptic today like APL or Prolog. We are talking about languages that are made to be… well… strange.

INTERCAL

We have to start at the beginning. INTERCAL. This was started as a joke in 1972 and the acronym is purportedly for Compiler Language With No Pronounceable Acronym. There was no actual implementation, though, until around 1990. Now there are two: C-INTERCAL and CLC-INTERCAL.

Since INTERCAL is a parody, it makes some very odd choices. For example, bitwise operators like AND operate with two arguments, but one of the arguments is reversed. That is, the top bit of one operand matches the bottom bit of the second operand. In a nod to social convention, there is a modifier known as PLEASE that you should sometimes use when, for example, reading data as in “PLEASE READ IN.” If you don’t use it often enough, the compile will fail warning you that the program is insufficiently polite. However, if you use it too often, you’ll also get an error that your program is excessively polite.

Originally, the implementation used EBCDIC, so it uses some characters that don’t appear on conventional 7-bit ASCII systems. This forced some character substitutions and now, with Unicode, some versions will allow the old-style characters if you prefer them. The INTERCAL manual renames nearly all the special characters for further confusion. A single quote is a “spark” and the equal sign is a “half-mesh”. Only the ampersand remains unscathed.

Want to know more? Be careful what you wish for.

FALSE and Brainf**k

Fast forward to 1993 to the birth of FALSE, a stack language made to be unreadable. As a consolation, the compiler only needed 1,024 bytes. This inspired an even more minimal language, Brainf**k. There are only eight characters needed in a BF program.

Brainf**k has spawned a lot of similar languages like Befunge and JSF**k. If you’ve heard of only one language in this post, it was probably this one.

What does it look like? From the esoteric language Wiki:

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

That’s Hello World, by the way!

Binary Combinatory Logic and Unlambda

We once knew a college professor who used to say “maximize the boolean variable” when he meant “set the bit to 1.” We think he’d like BCL. If you want to express true in BCL, you write K(KK). False? K(K(SK)). It gets worse from there. Here’s XOR: S(S(S(SS)(S(S(SK)))S))K.

However, this is binary, so S is really 01 and K is 00 and the left parenthesis is a single 1. Super strange and apparently has some application in some theoretical math studies.

There are several versions of this, all slightly different. Unlambda, for example, uses a lot of different characters. Here’s a “cat” program in Unlambda:

```s`d`@|i`ci

Whitespace

Most programming languages don’t care about white space and you can use it liberally or not. That is, in C you can write:

x=10*2;

or:

x = 10

*

2;

The compiler doesn’t care. Python is different. Indentation levels matter. Whitespace takes that to the extreme. The entire program is written in tab, space, and linefeed, and everything is ignored. That may seem odd, but interestingly it allows you to hide a program inside another program — as long as it isn’t a Python program.

The first whitespace character tells you what the next one means. For example, all flow control sequences start with a linefeed. Stack manipulation starts with a space. A tab and a linefeed introduce I/O operations. A tab and a space is for math and two tabs manage heap access.

Even numbers are in binary where a space is positive, a tab is negative. After that, a space is 0 and a tab is 1.

LOLCODE

While whitespace is possibly even less comprehensible than Brainf**k, some languages try to imitate particular readable things. Case in point: LOLCODE which has programs that match up with LOLCAT meme captions. Apparently, LOLCATs were the main reason the Internet was invented, after all.

Why do we assume cats talk like this? We aren’t sure, but we have a feeling the narrative inside a real cat’s brain is more like, “It is certainly hard to find good servants these days!” The ancient Egyptians worshipped cats and cats have not forgotten this.

Here’s a program to count to 10:

HAI 1.3
IM IN YR loop UPPIN YR var TIL BOTH SAEM var AN 10
VISIBLE SMOOSH var AN " " MKAY!
IM OUTTA YR loop
KTHXBYE

Rockstar

Maybe you aren’t a fan of LOLCATs but you like rock music. Well, then, Rockstar is the programming language for you. Variable names can be almost anything and data have types like “mysterious.”

We assume that to be a good coder in this language you need to grow your hair out, mumble, and own at least one article of clothing made of spandex. Come to think of it, that describes quite a few programmers we know.

Among the clever things it does, numbers are expressed in the length of words, and many programming constructs have “obvious” English-language correlates. So “Hate is water” assigns 5 to the variable “Hate”.

Here’s Fizbuzz written in Rockstar:

Midnight takes your heart and your soul
While your heart is as high as your soul
Put your heart without your soul into your heart

Give back your heart

Desire is a lovestruck ladykiller
My world is nothing 
Fire is ice
Hate is water
Until my world is Desire,
Build my world up
If Midnight taking my world, Fire is nothing and Midnight taking my world, Hate is nothing
Shout "FizzBuzz!"
Take it to the top

If Midnight taking my world, Fire is nothing
Shout "Fizz!"
Take it to the top

If Midnight taking my world, Hate is nothing
Say "Buzz!"
Take it to the top

Whisper my world

Shakespeare

If rock music is too pedestrian for you, there’s always SPL, the Shakespeare Programming Language. Like the bard, the programming language isn’t known for its economy of words.

Numbers are especially tricky in SPL. Nouns have a value of -1 or 1 depending on how nice they are (e.g., trees and flowers are 1 while pigs are -1). Adjectives multiply by 2. So “lying stupid fatherless big smelly half-witted coward” is -1 (coward) * 2 * 2 * 2 * 2 * 2 * 2 = -64.

Around the Hackaday watercooler, we’ve thought about writing a new version of this language where all programs are in the form of a conversation between the bard and Sir Francis Bacon. We’ll call it Shake ‘n Bake.

Here’s just part of the 89-line Hello World script — er — program:

The Infamous Hello World Program.

Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ophelia, a remarkable woman much in dispute with Hamlet.
Hamlet, the flatterer of Andersen Insulting A/S.


Act I: Hamlet's insults and flattery.

Scene I: The insulting of Romeo.

[Enter Hamlet and Romeo]

Hamlet:
You lying stupid fatherless big smelly half-witted coward!
You are as stupid as the difference between a handsome rich brave
hero and thyself! Speak your mind!

You are as brave as the sum of your fat little stuffed misused dusty
old rotten codpiece and a beautiful fair warm peaceful sunny summer's
day. You are as healthy as the difference between the sum of the
sweetest reddest rose and my father and yourself! Speak your mind!

You are as cowardly as the sum of yourself and the difference
between a big mighty proud kingdom and a horse. Speak your mind.

Speak your mind!

[Exit Romeo]

Scene II: The praising of Juliet.

[Enter Juliet]

Hamlet:
Thou art as sweet as the sum of the sum of Romeo and his horse and his
black cat! Speak thy mind!

Malbolge

Malbolge was designed to be difficult to use. Reportedly, the first program to print hello world required another computer program to search all the possible programs until it found the right sequence. If you don’t recognize the reference, Malbolge is a misspelling of Malebolge, the 8th circle of hell in Dante’s Inferno.

Malbolge uses a base-three virtual machine. There are only a few instructions including rotate right and the “crazy” operation that changes bits in a way defined in a table and — as far as we can tell — has no relation to any normal math operation, and is essentially encryption. Malbolge is so awful that there are some attempts like Dis have been made to be “slightly less evil.”

Piet

Have you ever noticed how in science fiction movies, aliens almost always communicate using some kind of sound we can hear? They either speak English or they speak something that sounds like Andy Kaufmann doing a character. You rarely see aliens that flash lights, emit pheromones, or beam low-frequency radio waves to communicate. All the languages on this list use characters of some sort either as numbers, symbols, or words. Except for Piet. Piet programs are abstract art of the sort created by Piet Mondrian.

A single unit of code is a codel and blocks of codels have the same color. The “program counter” can move in two dimensions, of course. If Piet interpreted, for example, red as add and green as jump then it would be another form of symbols. But that’s not how it works. Instead, the interpreter looks at the change in hue and intensity between colors. So one step in hue and no change in lightness is an add operation. But if the color changes darker, that’s subtract. Here’s hello world in Piet. Don’t ask us to explain it!

Why? Why?

It isn’t worth wondering why people create or use these languages. Why do people buy pet rocks? Why do people collect postage stamps? They just do. Still, learning a little about one of these quirky languages can push you out of your comfort zone and that’s not always a bad thing. Besides, a lot of people would say writing assembly for a PIC or AVR is only slightly less cryptic than Malbolge and many Hackaday readers do that.

As for us, we’ll stick with more practical programming languages. Forth seems cryptic, but is great and can create very legible programs in the hands of an expert. We do, however, occasionally dive into these languages for fun.

47 thoughts on “Strange Computer Languages: A Hacker’s Field Guide

    1. Yes, the follow-on to GW Basic.

      I love the Peek & Poke commands, as well as I/O equivalents. Made hardware projects easier to implement, especially when sing the printer port for I/O on an old XT

    1. If one did, I’m sure the line numbering would be of some form like: “each line number must be relatively prime to all preceeding it, but no line number may be prime” or “line number sequencing will be by the row numbers of occupied cells in an n-queens problem” under some constraint to force a unique solution for each n (there are many possible)

  1. Years ago, Mark Chu-Carroll had a whole series on “Pathological Programming Languages”.

    * The world’s smallest languange: [Iota][iota] only 2 characters. Also OISC: One Instruction Set Computers.
    * Ultimate spaghetti coding with Linguini
    * Unlambda: programming without variables
    * Semi-Thue grammars, where the grammar itself changes on the fly
    * The pathological stack hell of Underload, or the crazy stack games of Kipple or Enema.
    * A whole series of 2-dimensional languages. Clunk works not by flowing across the screen, but by connecting actual shapes.

    Even some genuine langues like TECO can qualify.

    His blog “Good Math Bad Math” has bounced around over the years, but the series is currently at
    http://www.goodmath.org/blog/category/good-math/programming/pathological-programming/
    (and keep scrolling down)

        1. Four Phase Systens had a weirf scripting language calle $EDIT thet used the video buffer for scratchpad memory. Programs could access any location on the screen usein x-y positions amd since the line of code currently executing, it ws\as trivial to wrie self modifying scripts

          1. Named 4-Phase because its creators in Cupertino wanted one better than 3 phase as in 3phase circuit.
            Last language I remember was Vision.
            I think Motorola bough the company and trashed it.

  2. I always thought it would be fun to write multiple interpreters for an esoteric programming language in different esoteric programming language and integrate them into a single interwoven text block. One interpreter would interpret the text block one way, which was actually an interpreter to interpret the same text block another way. The last interpreter would implement the original interpret language. This means you could run the program with an interpreter that would interpret ANY of the languages in the loop and they would all do nothing. :)

  3. I know this is off topic, but that graphic at the top is extremely 3D to me. Happens only when I’m wearing these prescription safety glasses. Starting from the background the colors come forward in the order blue, yellow, violet and orange. The green is hard to judge in its order. Glasses like mine would add some extra interest and fun to computer games I would assume…

      1. Somehow I missed the mention to the wiki on the Brain F entry, was looking for a “But wait there’s more” type header pointing out there are far more things to find than the ones mentioned.

  4. IIRC Malbolge wasn’t just intended to be “difficult to use”, the original intent was for a language that was provably turing-complete, but impossible to ever write a working program in. Obviously it failed in that goal, but finding that first program was still a major feat.

  5. Befunge is even somewhat usable and makes some sense, imagine having a CPU with a program counter that is not mem[pc] but mem[pcx][pcy] and instead of pc++; you do pcx+=pcxd;pcy+=pcyd;.
    Now imagine the compact code you could create.

  6. You can obfuscate pretty well with C preprocessor.

    //—————-

    #include “_”
    _

    //————–

    //”./-”

    #include
    #define _ \
    int main()\
    {\
    printf(“Hello World\n”);\
    return 0;\
    }
    //—————-

    //… etcetera.

  7. > We aren’t talking about mainstream languages that annoy people like Lisp, Forth, or VBA.

    What people? I love them (minus VBA).

    Never seen Lisp, Forth and VBA paralleled :D

    Nice article

  8. For people interested in esolangs, please check out the wiki and also my blog https://esoteric.codes, where I interview the creators of INTERCAL, Piet, Malbolge and many others!

    There is a lot more here than just weirdness.

    The beauty of INTERCAL for me is in how it acknowledges we are not really in control, it is the machine — making the idea of “commanding” the machine ridiculous! In INTERCAL, we have to say “PLEASE”.

    brainfuck and Malbolge have algorithms discovered by many programmers experimenting with them over years. There was even a web server in bf at one point, written in all punctuation.

    Whitespace has inspired other languages that make code invisible or minimize it (I made one called Folders where code is expressed as combinations of empty folders). There is even the language Unnecessary, where the only valid program is the file that doesn’t exist.

    Shakespeare inspired other poetic esolangs like AshPaper and in:verse, where poetic code controls shaders, creating a relationship between the poetry and the visuals that result.

    There is a lot to explore!

  9. Lovely COBOL on flipping UNISYS mainframes:
    PRINT FILE ON DISK B SAVE
    or
    LOAD WFL FILE ON DISK B SAVE
    RUN WFL FILE ON DISK B SAVE

    the file or batch exec file is already on disk B so one wouldn’t naturally think the ending “save” command would be required. file is already there… shall the computer operator omit the “save,” the system would automatically delete the file after load or batch completing. just perfect for record compliance or any auditor.

  10. Contrary to the assertion in the article, Don Woods and I implemented INTERCAL in 1973, as a translator to SPITBOL (Speedy Implementation of SNOBOL). As I recollect, our implementation of 32 bit division took about 30 CPU seconds on an IBM 360/91, a high-end mainframe of the day.

Leave a Reply to BranflakeCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.