NullScript 1
Eight commands, 256 cells and no constants. Every value comes in through a queue.
A, 2019 · Turing complete: unknown · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
NullScript 1 was made by the esolangs.org user A in 2019, as a subset of NullScript 2. It looks like brainfuck, but there is no way to add 1. Values come from a parameter queue, and when the queue is empty they come from the input. With no input every cell stays 0.
Read the story
So the arithmetic is done in the queue. * puts the current cell at the back, and ' and + take from the front.
The machine
| Command | Does |
|---|---|
, | Print the current cell as a character |
< > | Move the pointer; it wraps around at 0 and 255 |
* | Put the current cell at the back of the queue |
' | Take the front of the queue into the current cell |
+ | Take two values and put their sum in the current cell |
{ | On 0, go on after the next } |
} | Go back to the last {, which tests the cell again |
Brackets do not nest. A { on 0 without a } after it ends the run, and a } without a { before it goes back to the start. The input is whole numbers, and once it runs out every value is 0.
Example
A number read once and put in the queue twice.
A number read once and put in the queue twice. + adds the two copies, 36 and 36, and 72 prints as H.
With the queue empty, + reads both of its values.
The cat is ',{',}. It reads a number and prints it as a character, then loops while the number is not 0. On 72 101 108 108 111 0 it prints Hello and then the 0 too, as a NUL character, before the { sends it past the } and the run ends.
Further
See also
Cell-based
Write your own in Run Convert a program from NullScript 1
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: nullscript-1.
Command line
shib run nullscript-1 -e ''\'',{'\'',}' --input '72 101 108 108 111 0'shib manual nullscript-1Source
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/nullscript-1.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org