Science Fair Project Encyclopedia
Spoon programming language
Spoon is an esoteric programming language written by S. Goodwin in 1998. Spoon is based on Brainfuck. To compose a Spoon program, the programmer strings together a sequence of tokens comprised of nothing but the textual characters "0" and "1".
It was designed by converting the 8 instructions of brainfuck to binary sequences using Huffman coding, and then adding two new instructions: EXIT (which immediately terminates execution) and DEBUG (which outputs the entire memory array). This gives the following instructions:
| Spoon instruction | Brainfuck equivalent | Meaning |
|---|---|---|
| 1 | + | increment the byte at the pointer. |
| 000 | - | decrement the byte at the pointer. |
| 010 | > | increment the pointer. |
| 011 | < | decrement the pointer. |
| 0011 | ] | jump back to the command after the corresponding [ if the byte at the pointer is nonzero. |
| 00100 | [ | jump forward to the command after the corresponding ] if the byte at the pointer is zero. |
| 001010 | . | output from the byte at the pointer (in ASCII). |
| 0010110 | , | input to the byte at the pointer (in ASCII). |
| 00101110 | None ("DEBUG") | output the entire memory array |
| 00101111 | None ("EXIT") | immediately terminate execution |
The language also allows some other characters to be substituted for '0' and '1', or even for '0' and '1' to be swapped (as long as the interpreter is told this on execution). It is thus possible to create Spoon programs which are also ASCII art.
Hello world
The hello world program is written in Spoon as follows:
0101111111110010001111111111010000001101100101001011111110010001111110 1000000110111001010111111100101000101011100101001011111111111001000110 0000000000000000001000000110110000010100000000000000000000000000000000 0000000101001011111111111001000111111101000000110110010100101111110010 0011111101000000110110010101110010100000000000000000000010100000000000 0000000000000000101001011111111111001000110000000000000000000100000011 011000001010
External links
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details


