Jump to content

Whitespace (programming language)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Michi cc (talk | contribs) at 16:06, 25 June 2006 (fixed strange char escapes). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
This article is about a programming language. For whitespace characters in computing, see Whitespace (computer science). For white space in graphic design, see White space (graphic design).
Whitespace with syntax highlighting

Whitespace is an esoteric programming language developed by Edwin Brady and Chris Morris at the University of Durham. It was released on 1 April 2003 (April Fool's Day). Contrary to most languages, which often ignore contiguous runs of whitespace characters, the Whitespace interpreter ignores any non-whitespace characters. Only spaces, tabs and newlines are considered syntax. An interesting consequence of this property is that a Whitespace program can easily be contained within the whitespace characters of another language, making the same code a valid program in both.

The language itself is an imperative stack-based language. The virtual machine on which programs run has a stack and a heap. The programmer is free to push arbitrary width integers onto the stack (only integers, currently there is no implementation of floating point numbers). The user can also access the heap as a permanent store for variables and data structures.

Humorously, Whitespace has been called a great language for secretive programs. Important code can be printed onto plain sheets of white paper and stored safely without worry of discovery by inspection.

Sample code

This prints "Hello World!".

   
   	  	   
		    	
   		  	 	
		    	 
   		 		  
		    		
   		 		  
		    
	  
   		 				
		    	 	
   	 		  
		    		 
   	     
		    			
   			 			
		  
  	   
   		 				
		    	  	
   			  	 
		    	 	 
   		 		  
		    	 		
   		  
	  
		    		  
   	    	
		    		 	
   		 	
		    			 
   	 	 
		    				
    
	
	     

    	

 			 

	  	 
	
     	
	   

  	

   	 

See also

Brainfuck, another esoteric computer programming language.