'NULL'
A programming language in zero dimensions. A program is one positive integer.
Turing complete: unknown · ●●● hard · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
In NULL the whole program is a number, x. Each step divides x by its smallest prime factor and multiplies a second number, y, by the same prime. The prime is the instruction. Primes are counted from 2 and wrap after 14, so 2, 47 and 107 are all the same instruction.
Read the story
Loops come from instruction 41, which swaps x and y. By then y holds every prime that has run so far, so swapping starts the same instructions over. The cat is 42539, which is 7 × 59 × 103. It reads a byte, prints it and swaps. The Hello World is a number of 170 digits.
The machine
Three queues of bytes, one selected, and the two numbers x and y.
| Prime | Does | Prime | Does |
|---|---|---|---|
| 2, 3 | Select the next, previous queue | 19, 23 | Move the front to the next, previous queue |
| 5 | Print the front byte | 29 | Drop the front |
| 7 | Read a byte into the front | 31 | Enqueue y mod 256 |
| 11, 13 | Subtract the front from y, add it | 37 | Skip the next prime if the front is 0 |
| 17 | Add y mod 256 to the front | 41 | Swap x and y |
| 43 | End |
The specification leaves the end of the input open. Reading past it ends the program, and so does x reaching 1.
Example
Ideas it shows
See also
Non-textual
Unknown year
Write your own in Run Convert a program from 'NULL'
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: null.
Command line
shib run null -e '42539' --input 'cat'shib manual nullSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/null.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org