Science Fair Projects Ideas - NULL programming language

All Science Fair Projects

      

Science Fair Project Encyclopedia for Schools!

  Search    Browse    Forum  Coach    Links    Editor    Help    Tell-a-Friend    Encyclopedia    Dictionary     

Science Fair Project Encyclopedia

For information on any area of science that interests you,
enter a keyword (eg. scientific method, molecule, cloud, carbohydrate etc.).
Or else, you can start by choosing any of the categories below.

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

Last updated: 05-29-2005 02:26:08
10-26-2009 08:16:03
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
Science kits, science lessons, science toys, maths toys, hobby kits, science games and books - these are some of many products that can help give your kid an edge in their science fair projects, and develop a tremendous interest in the study of science. When shopping for a science kit or other supplies, make sure that you carefully review the features and quality of the products. Compare prices by going to several online stores. Read product reviews online or refer to magazines.

Start by looking for your science kit review or science toy review. Compare prices but remember, Price $ is not everything. Quality does matter.
Science Fair Coach
What do science fair judges look out for?
ScienceHound
Science Fair Projects for students of all ages
All Science Fair Projects.com Site
All Science Fair Projects Homepage
Search | Browse | Links | From-our-Editor | Books | Help | Contact | Privacy | Disclaimer | Copyright Notice