So, here we go with another esoteric programming language. Here we have Whitespace, a stack-based, imperative language whose syntax consists entirely of invisible characters (specifically, space, tab and linefeed). The blame for Whitespace's existence lies with Edwin Brady and Chris Morris and it has a home at http://compsoc.dur.ac.uk/whitespace/ (archived version from 2015-07-15).
I have created my own implementation of Whitespace; it is written in Python 3 and named "BlueSpace". Bluespace is now hosted on GitHub at https://github.com/Smithers888/BlueSpace.
BlueSpace's features include:
- Interpret Whitespace code
- Compile Whitespace code to Python
- Read and write a printable syntax, as well as a readable assembly-style syntax
The ability to convert Whitespace code to the assembly syntax (`
--convertto=assembly') was actually one of the main reasons for starting this, as it enabled me to check that my Whitespace code actually represented the sequence of instructions that I had intended.
Known incompatibilities between BlueSpace 1.1 and WSpace 0.3:
- The ReadNumber instruction (tab-linefeed-tab-tab): WSpace accepts spaces between the negative sign and the number (e.g.
- 123is accepted as equivalent to
-123) which BlueSpace does not. Conversely, BlueSpace accepts a leading plus. (e.g.
+12is equivalent to
12) which is rejected by WSpace.
- WSpace ignores all trailling characters after the last point in the code that is visited; BlueSpace requires the entire input to be a valid Whitespace program. For example, the program consisting of four linefeeds is the null program according to WSpace, but BlueSpace reports a syntax error since the fourth linefeed does not constitute a valid command. This is due to WSpace's lazy parsing semantics.
- If a program defines the same label more than once, WSpace jumps to the first instance, while BlueSpace jumps to the last. I consider such a program to be erroneous and later versions of BlueSpace may report this as such.
Why BlueSpace? It is, in fact, named after Sir Lancelot's favourite colour; anyone who is familiar with the Python documentation should be sufficiently conditioned to expect such silliness.
Here is some code I've written in Whitespace.
- Here's the classic 99 Bottles of Beer program. It's encoded in the printable syntax, so it must be run with
./bspace.py -iprintable. (I nearly always write code in the printable syntax, as it is much easier to read.)
Here's my shortest quine to date, weighing in at a mere 486 bytes. While we're at it, here's the disassembly (although, of course, it is not a quine in this form).
- The above has been improved to 406 bytes. Here's the Whitespace and the disassembly.