Directory

Encyclopedia

NodeWorks
                              ENCYCLOPEDIA

Link Checker

Home
Encyclopedia : N : NU : NUL :

NULL programming language

 

NULL programming language

The NULL programming language is an esoteric programming language
designed to be zero-dimensional.
Its design was inspired by the two-dimensional Befunge language
to contrast with conventional one-dimensional programming languages.
A NULL program consists of a single arbitrarily large positive integer.

An interpreter for the language manages three queues of bytes and two integer variables x and y.
Initially x is set to the program-integer, y to 1
and the queues to 0, 1 and 2.
The instruction set consists of all the prime numbers, however, every 14th prime number corresponds to the same 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. 7 Input one character, then replace the byte at the front of the selected queue with its ascii value. 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. 13 Add the byte at the front of the selected queue to y. 17 Add y to the byte at the front of the selected queue. 19 Move the byte at the front of the selected queue to the rear of the next queue (2 loops to 0). 23 Move the byte at the front of the selected queue to the rear of the previous queue (0 loops to 2). 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. A program is executed as follows:
the value in x is divided by its smallest prime factor,
y is multiplied by that prime factor, and
the instruction corresponding to it is executed.
This process is repeated until the "End the program" instruction is executed
or until x is 0 or 1.

External links

  • NULL language specification
  • source code for NULL interpreter in Python by Kang Seonghoon


  • NodeWorks boosts web surfing!
    Page Returned in 1.137 seconds - HTML Compressed 68.8%

    This article is from Wikipedia. All text is available
    under the terms of the GNU Free Documentation License.
     GNU Free Documentation License
    © 2008 Chamas Enterprises Inc.