NULL - Esolang (2024)

NULL is a programming language in zero dimensions. Programs in it are single positive integers of arbitrarily large size.

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.

Instructions

2Select the next queue (wrapping around).
3Select the previous queue (wrapping around).
5Output the byte at the front of the selected queue (NUL if the queue is empty). NUL is '\0' (ASCII character 0).
7Input 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.
11Subtract 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.
13Add the byte at the front of the selected queue (0 if the queue is empty) to y.
17Add y mod 256 to the byte at the front of the selected queue, or enqueue y mod 256 there if the queue is empty.
19Remove 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).
23Remove 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).
29Remove the byte at the front of the selected queue.
31Enqueue y mod 256 at the end of the selected queue.
37If 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.
41Switch the values of x and y.
43End the program.

The instructions loop for every 14th prime number, meaning, for instance, 47 is equivalent to 2.

Examples

Hello, world!

This 170-digit number prints the words Hello, World!.

18090462148251759497492444420325028573004825667450262208483921113691874262881209112703483826587581124351159753006294894679414849393349134822194686265244710288508550347259

Cat program

This 5-digit number is a cat program. Note that its behavior on end of file is undefined.

42539

Truth-machine

461190218321951113117134453091156860683

External resources

NULL - Esolang (2024)
Top Articles
Latest Posts
Article information

Author: Edwin Metz

Last Updated:

Views: 6068

Rating: 4.8 / 5 (78 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Edwin Metz

Birthday: 1997-04-16

Address: 51593 Leanne Light, Kuphalmouth, DE 50012-5183

Phone: +639107620957

Job: Corporate Banking Technician

Hobby: Reading, scrapbook, role-playing games, Fishing, Fishing, Scuba diving, Beekeeping

Introduction: My name is Edwin Metz, I am a fair, energetic, helpful, brave, outstanding, nice, helpful person who loves writing and wants to share my knowledge and understanding with you.