Whitespace programming language

Someone (K-Rich, I think) pointed this out in #blenderchat, and I thought it was rather funny: http://compsoc.dur.ac.uk/whitespace/

The idea is that many programming languages (C, Java, etc) completely ignore whitespace (spaces, tabs and newlines) and only pay attention to the other letters (this lets you arrange the code how you want, by putting extra spaces in places to make it look nice)
The creator of the page considers it to be gross injustice, and to even the balance he’s created a language where only spaces, tabs and newlines are used, and everything else is completely ignored.

Anyways, the interperetor provided is written in Haskell, the compiler for which is too large for me to even consider using, so I ported it to Python.

http://www.cs.newcastle.edu.au/~c3018900/pywhitespace.tar.bz2 (linux users should have no problems with .tar.bz2, windows users might, but WinRAR reads them fine for me)

Now, in theory you could load these modules into blender and use them like

import Input
Input.execute("   		
 
 	
 	   	 	 		
	
     	  
 
 	
" +
              " 	   				 	
	
  	   	
 	   	 	 
	
  


")

which will happily proclaim in the console that 3+4=7 - not that you’d ever want to, but that’s beside the point, really…

so what do you think?

C and Java don’t ignore whitespace, they use them as words delimitors. Pascal does though.

The idea of a all whitespace language sounds funny enough though. How about an all non printable language? :stuck_out_tongue:

Martin

okay, “excess whitespace” then. happy?

Just read the site, it will all become clear :wink:

Funny, but a non printable character language would be even funnier IMHO.

Martin

Sounds interesting but was he joking when he said:

Whitespace is a particularly useful language for spies. Imagine you have a top secret program that you don’t want anyone to see. What do you do? Simply print it out and delete the file, ready to type in at a later date. Nobody will know that your blank piece of paper is actually vital computer code!

ehm…you think? :smiley:
although if you have a dot after each whitespace you could print it…but then again, there is morse… (…no pun intended)

Roel

ehm…you think? :smiley:
although if you have a dot after each whitespace you could print it…but then again, there is morse… (…no pun intended)

Roel[/quote]

Yeah I suppose. Wouldn’t be a blank piece of paper though and I’m sure the secret agencies would know of this technique before anyone else did if it was practical. I don’t really see that the language would be any use in general because it looks fairly hard to do even simple programs. Still interesting, though.

If you think that’s interesting, you should look at BrainFuck: http://www.muppetlabs.com/~breadbox/bf/

Martin

If you think that’s interesting, you should look at BrainFuck: http://www.muppetlabs.com/~breadbox/bf/

Martin[/quote]

No way, I can’t even imagine a whole compiler being just a couple of hundred bytes. Most of my text files aren’t even that small. I guess that’s how compilers and most software in general started out.

Whitespace is a particularly useful language for spies. Imagine you have a top secret program that you don’t want anyone to see. What do you do? Simply print it out and delete the file, ready to type in at a later date. Nobody will know that your blank piece of paper is actually vital computer code!

Bleh, typing, so low-tech. Obviously you’d scan in the blank page, to save time.

Oh, and in the FAQ page:

Is there a practical use for Whitespace?
I doubt it.

And, I found the slashdot article about it - April 1st 2003 - how appropriate :wink: