Whitespace (programming language): Difference between revisions

Content deleted Content added
date format audit, link maintenance
TepigMC (talk | contribs)
Add copy and swap operations from
Line 2:
[[File:Whitespace in vim2.png|right|206px|thumb|Whitespace [[hello world program]] with syntax highlighting {{legend|#0000ab|tabs}} {{legend|#ab0000|spaces}}]] <!-- make SVG file -->
 
'''Whitespace''' is an [[esoteric programming language]] developed by Edwin Brady and Chris Morris at the [[University of Durham]] (also developers of the [[Kaya (programming language)|Kaya]] and [[Idris (programming language)|Idris]] programming languages). It was released on 1 April 2003 ([[April Fool's Day]]). Its name is a reference to [[whitespace character]]s. Unlike most programming languages, which ignore or assign little meaning to most whitespace characters, the Whitespace interpreter ignores any non-whitespace characters. Only [[Space character|spaces]], [[Tab character|tabs]] and [[linefeed]]s have meaning.<ref name="whitespace">{{cite web|url=http://compsoc.dur.ac.uk/whitespace/tutorial.htmlphp|title=Whitespace|website=Compsoc|access-date=2015-10-26|url-status=dead|archive-url=https://web.archive.org/web/2015110123074420150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.htmlphp|archive-date=118 NovemberJune 2015}}</ref> A consequence of this property is that a Whitespace program can easily be contained within the whitespace characters of a program written in another language, except possibly in languages which depend on spaces for syntax validity such as [[Python (programming language)|Python]], making the text a [[polyglot (computing)|polyglot]].
 
The [[programming language|language]] itself is an [[imperative programming|imperative]] [[stack-based language]]. The [[virtual machine]] on which the programs run has a stack and a [[dynamic memory allocation|heap]]. The programmer is free to push arbitrary-width integers onto the stack (currently there is no implementation of floating point numbers) and can also access the heap as a permanent store for variables and [[data structure]]s.
Line 40:
|-
| [Space] || [LF][Space] || - || Duplicate the top item on the stack
|-
| [Space] || [Tab][Space] || Number || Copy the nth item on the stack (given by the argument) onto the top of the stack
|-
| [Space] || [LF][Tab] || - || Swap the top two items on the stack
|-
| [Space] || [LF][LF] || - || Discard the top item on the stack
|-
| [Space] || [Tab][LF] || Number || Slide n items off the stack, keeping the top item
|-
| [Tab][Space] || [Space][Space] || - || Addition