The Wonderful World of Esoteric Programming Languages
Short Bytes: Esoteric programming languages or esolangs are those designed for fun with crazy syntax. But they have a hidden purpose – exploring the nature of programming languages and computability with a minimalistic design. This post sheds some light on the wonderful world of esolangs.
The following is a valid program. Yes, just one ASCII (extended) character.
Ò
It computes the prime factors of a number given in the input stream. This is a language called as 05AB1E. Don’t believe me? Test it here. That’s amazing, right? Welcome to the regime of esoteric languages.
Some Background –
Programming is more than just a set of instructions given to a computer. It is a way of unraveling the very nature of computation and what it means to compute using a digital machine. It is very hard to grasp this concept unless one actually tries to communicate with a machine that does the computation. Programming languages are tools with specific grammar and logic that enables this type of communication.
The programmer is limited, in a rather narrow way, by the capabilities of the programming language. It is an interesting thought that liberating the programming languages from their traditional design can lead to new insights about their structure and interpretation. Esoteric languages do just that. With a weird syntax and crazy logical foundation, the creators develop a functionally sound programming language. That is remarkable!
The design of esolangs is designed based on several themes like lifestyle, jocose, brevity, fiction, and minimalism. However, they are not designed for mainstream use. Nonetheless, Esolangs are amusing and fun to code; They are even categorised as Software Art, in some cases, it is literally an art.
Here are some interesting esolangs –
Fish –
Fish (Represented by ><> ) is a Turing complete (it can simulate any algorithm) 2D programming language. It has an instruction pointer which moves across a 2D grid world and executes the instructions in that grid. Each character in the grid represents one operation amongst the 4 types – Arithmetic, Stack, I/O or Navigation. Well, what can it do, you ask? The following 5 line code can compute Pi accurately to 15 decimal places!!
>l:a)?v>&48&:&*1+,28&:&*4+,-18&:&*5+,-18&:&*6+,-v ^ < v? &/ ~v < \, <~v? <:-3l+1f / \>l2(?v+^ ~ >&f1+*&1-:v >n; \ ^? /
The output is 3.141592653589793. Test it here for yourself – Fish Language Playground. Just click the Submit button and run the code.
Brainf*ck –
Brainf*ck is one of the most popular esolangs due to its mind boggling code. It has just 8 instructions encoded on a long tape. It has one of the smallest compilers with just 240 bytes!! The following code is a “Hello World” program in a minimalized form.
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>- >>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++. ------.--------.>>+.>++.
Try it here!! It is Turing complete and primarily used for challenges and amusement.
Malbolge –
This yet another infamous esolang with notoriously hard syntax. It was specifically designed so that it is as difficult to program in as possible. The first “Hello World” Program in Malbolge was created by a Lisp program. You need to specifically program to program in Malbolge!!! Programiception!!
Note: The explanation for the code syntax for the above languages is beyond the scope of this post. The reader is highly encouraged to follow this link and learn more about these languages.
Pushing the Limits of Craziness –
Esolangs thrive due to the creativity of humans; however crazy they may be. Here are some more crazy-weird esolangs –
- Pikalang – A programming language based on the sounds made by the Pokemon Pikachu.
- Sacred is a language that is purely composed of parentheses.
- Emojicode is a language consisting of emoticons.
- Piet is an image-based programming language in which the colour of each pixel is an instruction.
- Gravity is a language that executes based on simulation of objects in a gravitational field.
But there are deep implications in designing esolangs. Esolangs are used to test the boundaries of programming language design, implementing new paradigms, proving new theorems and even enhance our reasoning capabilities. These are profound enough reasons to take esolangs seriously yet enjoy their craziness.
Unleash your craziness and start coding your favourite esolang. Which is your favourite esolang? Have a crazy idea for an esolang? Share it with us in the comments.