Esoteric Programming Languages

We will be looking at Esoteric programming languages. They can be used as learning tools to teach fundamentals of language design, mechanics, and toolchain functionality. In addition, they hilariously showcase the engineers great wit and prowess!

Esoteric Programming Languages

Intro

Today, we will be looking at Esoteric programming languages. As a practical programmer, these languages have no benefit to our professional careers. That being said, they can be used as learning tools to teach fundamentals of language design, mechanics, and toolchain functionality. In addition, they hilariously showcase the engineers great wit and prowess!

Piet

Piet is a programming specification and language which uses location of color to drive the code. Yes, you read that right. You are creating abstract art to program with this language.

The interpreter reads contiguous blocks of color codes in order to execute commands.

Piet is a stack based language where each non-black and non-white color blocks represent data. When moving to a block, the instruction executed is based on the difference in hue between the previous block. Black and white blocks are used to control the flow of execution.

My favorite of the samples is the program which is used to approximate Pi. It does this by summing the area of the literal circle in the bitmap and dividing by the radius squared. So a larger bitmap will produce a more accurate result. Genius!

piet_pi_big
Piet program for calculating Pi.

Even more surprising is that Piet is considered Turing-complete.

Velato

Velato uses musical composition as a source of writing code.

Instructions are executed using a variety of pitch and note arrangements. The implementation of the language allows for freedom of time signature, key signature, rests, and repeat marks in order for each composition to be unique and free flowing.

The compositions are known to have a jazz feel to them.

Listen to the free-form Jazz of Hello World.

Brainfuck

Brainfuck is a notable minimalistic esoteric language created in 1993. It was created as a means for creating the smallest compiler for a Turing-Complete language. As such, this inappropriately named language is often taught at Universities as a way of introducing compiler theory and the notions of stack based languages.

The instruction set is very small and only offers 8 distinguishing commands making it very difficult to decipher visually.

Here we see an example of a Hello World program.

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

This language was never meant to be used in a production setting. Ironically, one of the best uses of Brainf*** is for checking the completeness of another esoteric language. If a Brainf*** compiler can be created using another language, that language is also considered Turing-complete as a result.

Resources

If you would like to know more about these languages and try them yourself, go to the Esolang Wiki.