Watnoxt
What? 1? Next line! Three instructions on a row of bits, and the line you are on decides what happens at its end.
Vallee152, 2022 · Turing complete: with unbounded memory · ●●○ moderate · esolangs.org
Tested with 6 known programs · Test method
Run it
The idea
Vallee152 made Watnoxt in 2022, starting from brainfuck. It has three instructions and a fixed row of bits. The name comes from "what not" and from how it runs. The only jump is ?, which drops one line down when the current bit is 1.
Read the story
What a line does at its end depends on its number. Line 2 ends the program, line 3 prints and starts over, line 4 reads and starts over, and every later line just starts over. So a program prints by arranging for the pointer to fall into line 3 and run off its end.
The machine
Line 1 runs once and builds the bits.
| Char | Does on line 1 |
|---|---|
> | Add a cell of 0; without any there is one cell |
! | Set the last cell to 1 |
? | Start the pointer on the last cell made so far |
From line 2 on.
| Char | Does |
|---|---|
> | Move the pointer right, wrapping round |
! | Flip the bit under the pointer |
? | If the bit is 1, move down a line, still one column to the right |
Every other character does nothing. A jump from the last line goes to line 2. Line 3 prints cells 0 to 6 as a 7-bit character, cell 0 the high bit, and line 4 reads a character into them. With fewer than 7 cells this implementation prints and reads whole numbers instead, which the specification allows.
Example
The hi.
The hi. Line 1 builds 1101001, an i, with the pointer on the last bit. The ? on line 2 sees a 1 and drops to line 3 one column on, where ! turns the i into an h, and the end of line 3 prints it. The next pass turns it back into i and prints again. The third pass jumps from line 3, the last line, round to line 2 and lands past its end, which ends the program.
The truth machine works on a single bit, so it reads and prints whole numbers. On 1 it prints 1 forever.
The specification also has a 33-line program that adds two digits. It gives the right character for all 100 pairs, and a sum past 9 comes out as : ; < and so on, as the specification warns.
Patterns it teaches
- Two-dimensional control flow: the only jump goes one line down, and the line decides what its end does.
- Turing tarpit: three instructions, but a fixed number of bits, so it never quite gets there.
Further
See also
Watnoxt builds on Brainfuck.
Declarative paradigm
Two-dimensional languages
Write your own in Run Convert a program from Watnoxt
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: watnoxt.
Command line
shib run watnoxt -e '!>!>>!>>>!?
?
?!'shib manual watnoxtSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/watnoxt.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org