Forget Python, Java, C, C++ for a while…
As the world is moving towards making programming languages easy to use and learn, there is a set of creative people who love playing with abstract ideas and have created some amazing programming languages. They definitely go against the general principles and are done just for fun.
This gives me immense hope that not everything in the world has to be useful and not everything we do individually should be useful as well. I hope you find this article entertaining.
Here are 6 of the weirdest and impractical languages ever created.
1) ///
One of the hardest languages to search on Google. This definitely is my favorite. /// is a minimalist language that consists of only one operation — string substitution in the form /source/replacement/
. The language is very limited, but some clever programmers are able to turn the string substitution operation into fully working programs that loop and output data. Here is a simple "Hello, world!" program:
/ world! world!/Hello,/ world! world! world!
There is even a complex program written in ///. The Fibonacci sequence code will look like this.
/!/\/.\\0\/,\\,0,\\,1\/\/.\\1\/,\\,0\/\/,\\,\/.\/\/+\\+\/=\\=.\\1-\/\/=\\=\/+\\+\//!!!!!!!!!/.///+\+///-/\\\///0/1//1/*/++.1
2) Glass
Glass is an esoteric programming language developed by Gregor Richards. It combines an unintuitive postfix notation with heavy object-orientation, requiring extensive juggling of the main stack combined with its object-oriented structure. It is one of find as no other language is implemented like this and this is what makes it so unique.
Here is an example of a program for 99 bottles of beer:
{B[b<99>^]}{P[(c__)oO!aA!][poo.?][b(_m)1=,(_x)<0>(_m)*ae.
?=(_y)<1>=/(_x)"No more"oo.?(_x)0=(_y)0=\/(_y)(_m)*o(on).
?(_y)0=\" bottle"oo.?(_x)<1>(_m)*ae.?=/(_x)^(_x)0=\"s"oo.
?]}{C[(c__)oO!aA!sS!pP!][gn*][xn1=,][dnn*<1>as.?=][vn*pb.
?" of beer on the wall,\n"pp.?n*pb.?qe" of beer,\n"pp.?
"Take one down, pass it around\n"pp.?ln*<1>as.?=l*pb.?wu
" of beer on the wall.\n\n"pp.?]}{M[moO!cC!bB!bb.?cx.?fc
g.?=/fcv.?cd.?fcg.?=\]}
3) Chicken
Chicken is not only the name of the language but also the only keyword that is allowed in it! The number of repetitions and new lines determines the opcode which is executed. An example program follows. Can you guess what it does?
It is indeed a lot of code but it only prints “Chicken Power!”. You can play with it here.
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken
4) Befunge
Interesting fact: Befunge is believed to be the first two-dimensional, ASCII-based, general-purpose programming language.
It is a two-dimensional programming language. Your code is placed on the playing field with a fixed size. Each cell of the playfield can hold either code or data, and your program can replace any cell it wishes with either.
The interpreter starts at the top-left cell and continues to the right. You can control the direction which the interpreter takes with special directional instructions. For example, this is an infinite loop:
>v
^<
And this is a “Hello, world!”:
0"!dlroW ,olleH">:#,_@
And factorial is also quite straightforward:
&>:1-:v v *_$.@
^ _$>\:^
5) Piet
Piet is a programming language in which programs are bitmaps that look like abstract paintings. The language is named after Piet Mondrian. The basic building block for Piet programs is the color block. It supports 20 distinct colors, with some implementations having support for more. The compilation is guided by a “pointer” that moves around the image, from one continuous colored region to the next. You can find multiple samples here.
“Hello world!” program in Piet
6) Shakespeare Programming Language (SPL)
A character list at the beginning of the program declares a number of stacks, naturally with names like “Romeo” and “Juliet”. These characters enter into dialogue with each other in which they manipulate each other’s topmost values, push and pop each other, and do I/O. The characters can also ask each other questions which behave as conditional statements. On the whole, the programming model is very similar to assembly language but much more verbose.
So here is a mini example that essentially shows the stripped-down version of the Hello World.
The Useless Example Program.
Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
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 smelly coward!
You are as stupid as the difference between a rich brave
hero and thyself! 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!
Listen to your heart!
Juliet:
Am I better than the product of a miserable liar and a beautiful flower?
Hamlet:
If so, let us return to szene I.
[Exeunt]
I hope you enjoyed reading this.
Resources: