untitled
viviti

Click here. You won't be turned into some kind of brain-eating zombie if you do.



The NULL Programming Language

This programming language was actually inspired by Befunge.
Most languages are one-dimensional, and Befunge is two-
dimensional and can be extended to n dimensions. The only
thing that was missing (other than fractal programming
languages) was a zero-dimensional language. Since I had
no idea what a zero-dimensional language would look like
or how it would work, I designed this instead.

Each NULL program consists of a single positive integer.

NULL uses three queues of bytes, 0, 1, and 2, and two variables, x and
y, which are arbitrarily high nonnegative integers.

At the beginning of the program's execution, all three queues are empty, y equals
1, and x equals the program's source code. A loop is then formed: X is divided
by its smallest prime factor and y is multiplied by it. Then the instruction
corresponding to that number is executed. This repeats until either the "End the
program." instruction is executed or x equals 0 or 1.

Instruction Set:

every 14th prime
number starting with:
corresponding instruction:
2 Select the next queue (2 loops to 0).
3 Select the previous queue (0 loops to 2).
5 Output the character whose ascii value is the same as the
byte at the front of the selected queue. An empty queue
returns 0.
7 Input one character, then replace the byte at
the front of the selected queue with its ascii value. If the
queue is empty, enqueue it to the rear of the selected queue
instead.
11 Subtract the byte at the front of the selected queue from y.
If this would reduce y to less than 0, then y=0 instead. An
empty queue returns 0.
13 Add the byte at the front of the selected queue to y. An empty
queue returns 0.
17 Add y%256 (y's least significant byte) to the byte at the front
of the selected queue. If the queue is empty, enqueue it to the
rear of the selected queue instead.
19 Dequeue the byte at the front of the selected queue and enqueue
it to the rear of the next queue (2 loops to 0). An empty queue
returns 0.
23 Dequeue the byte at the front of the selected queue and enqueue
it to the rear of the previous queue (0 loops to 2). An empty
queue returns 0.
29 Dequeue the selected queue.
31 Enqueue y to the selected queue.
37 If the selected queue is empty or the front byte 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.



Implementations

NULLRUN, a NULL interpreter in Python by Kang Seonghoon (Tokigun)

Hello World Program

This 176-digit program, also by Tokigun, outputs "Hello, world!"
153609393637869503971282839335995386248921743204830348570033
550157913898858976126298703504031567456769368158187308369080
75646108694411913908753341542249057283074613678144889367

A Language With Only One Instruction?

A language with only one instruction is possible, using NULL:

X is an arbitrarily large positive integer with an initial value of zero.

Instruction Set:
*
Increment X. If this is the last instruction in the source file, execute X as a NULL program.

Most useful programs, however, would require over 2^1024 instructions, so I wouldn't recommend actually using it.
This Website Built and Hosted for Free at Bravenet.com

Web Hosting · Blog · Guestbooks · Message Forums · Mailing Lists
Easiest Website Builder ever! · Build your own toolbar · Free Talking Character · Email Marketing
powered by a free webtools company bravenet.com