Whitespace Programming Language

If you code in multiple languages, you probably have a favorite language. Although Whitespace is not my favorite language (I doubt it is for anyone), I found the concept behind it both fascinating and ridiculous, and hence this article devoted to this programming language.

Whitespace is based on a very interesting concept. Programs in this language are written with only whitespaces, so just space, tab and newline! You can write an entire whitespace program using just your spacebar, the tab key and the enter key. One hilarious thing I realized when I first read about this language, was that if you opened a whitespace program in any normal text editor (notepad, sublime text, atom, etc) you would just see a blank file!

Released on 1st April 2003, the language seemed just like an elaborate April Fool’s prank. Added to this was the fact that the idea for the language came up during a conversation in a pub!

However, other than being a joke, languages like Whitespace do have a purpose. Languages like these are designed to demonstrate how it is possible to come up with a language using just a couple of characters. Languages like this are also often considered as software art.

One interesting thing about Whitespace is that when an interpreter (an interpreter can be thought of as what runs a piece of code) works on whitespace code, it completely ignores non-whitespace characters. What makes this fact even more interesting is that most other programming languages ignore whitespaces, or would treat a space and a tab as being completely interchangeable. With these two pieces of information, what one could do is write a whitespace program in a file that actually contains another program.

So let’s say I write a Java program, but I include tabs and spaces in each line such that they form a meaningful Whitespace program as well, I could run the same file as a Java program or as a Whitespace program!

For those of you who might be interested in taking a look at Whitespace programs, head over to this link– it is an online Whitespace IDE that I found, and it highlights spaces and tabs differently for us to be able to read the program. Also, if you liked the article, do give it a like, and follow my blog if you haven’t already!

Have something to say about this post? Drop a comment here!