NTFJ
NAND, TRUE, FALSE, JUMP. Every other operation, even AND, is built from those.
Conor O'Brien, 2016 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 6 known programs · Hello World on Try It Online: identical · Test method
Run it
The idea
Conor O'Brien made NTFJ in 2016 with four commands, whose initials are its name. More were added later for convenience, but the core idea stayed. The stack holds bits, # pushes a 1, ~ pushes a 0, and | replaces two bits by their NAND. NOT is :|, AND is |:|, and OR takes a little juggling with the stack.
Read the story
Text needs bytes, so @ turns eight bits into a byte, and * prints one. A Hello World is 13 groups of eight bits, each followed by @*.
The machine
| Command | Does |
|---|---|
~ # | Push 0, push 1 |
\| | NAND of two values (255 minus their AND if they are bytes) |
@ | Eight bits into a byte, the first pushed the highest; or a byte back into bits |
* | Pop and print a byte |
( … ) | If the top is 0, jump past the next ); nothing is popped |
$ : / | Drop, duplicate, push the length of the stack |
{ } | Pop n; move the bottom to the top, or the top to the bottom, n times |
^ | Jump to command n |
This implementation leaves out ^, since which command it counts from is not known, so a program using it stops with an error.
Example
The second puts the bits 0011000 down first, then works out 0 OR 1 with the stack juggling from…
The second puts the bits 0011000 down first, then works out 0 OR 1 with the stack juggling from esolangs.org, :|#}:|#{|. The result becomes the lowest bit of 48 plus it, the code of 1.
Further
Ideas it shows
See also
Also in Turing tarpits
Write your own in Run Convert a program from NTFJ
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: ntfjc.
Command line
shib run ntfjc -e '~~~~/*'shib manual ntfjcSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/ntfjc.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org