NULL
From Esolang
NULL is a programming language in zero dimensions. Programs in it are single positive integers of arbitrarily large size.
Contents |
[edit] Runtime environment
The environment available to a NULL program consists of three queues of bytes, initially empty, and two arbitrarily large integer variables, x and y. x is set to the program, while y is set to 1.
Then x is divided by its smallest prime factor, y is multiplied by the same, and the instruction corresponding to the prime factor is executed.
[edit] Instructions
| 2 | Select the next queue (wrapping around). |
|---|---|
| 3 | Select the previous queue (wrapping around). |
| 5 | Output the byte at the front of the selected queue (NUL if the queue is empty). NUL is '\0' (ASCII character 0). |
| 7 | Input one byte and replace the value at the front of the selected queue with it; or, if the selected queue is empty, enqueue the value there. It is currently undefined what to do when EOF has been reached. |
| 11 | Subtract the byte at the front of the selected queue (0 if the queue is empty) from y. If this makes y less than zero, y is set to 0. |
| 13 | Add the byte at the front of the selected queue (0 if the queue is empty) to y. |
| 17 | Add y mod 256 to the byte at the front of the selected queue, or enqueue y mod 256 there if the queue is empty. |
| 19 | Remove the byte at the front of the selected queue (use 0 if the queue is empty) and enqueue it to the rear of the next queue (wrapping around). |
| 23 | Remove the byte at the front of the selected queue (use 0 if the queue is empty) and enqueue it to the rear of the previous queue (wrapping around). |
| 29 | Remove the byte at the front of the selected queue. |
| 31 | Enqueue y mod 256 at the end of the selected queue. |
| 37 | If the selected queue is empty or the byte at the front of it has a value of 0, divide x by its smallest prime factor and multiply y by that number. |
| 41 | Switch the values of x and y. |
| 43 | End the program. |
The instructions loop for every 14th prime number, meaning, for instance, 47 is equivalent to 2.
[edit] Examples
[edit] Hello, world!
This 176-digit number prints the words Hello, world!.
153609393637869503971282839335995386248921743204830348570033 550157913898858976126298703504031567456769368158187308369080 75646108694411913908753341542249057283074613678144889367

