PNID
Brainfuck with a letter for each command, plus strings, numbers, a jump and a coin to toss.
Lealcy Tardelli Belegante, 2017 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Lealcy Tardelli Belegante made PNID in 2017. The name lists its first four commands, Previous, Next, Increment and Decrement. It is a superset of brainfuck, so < > + - [ ] . , still work, and each of them also has a letter. Around them come shortcuts. A whole string goes into memory with one command, a number with another, and ; prints a cell as a number instead of a character.
Read the story
Two commands are odd ones. j jumps the program to the position held in the current cell, and % puts a random number in it. The coin toss uses % to print heads or tails.
The machine
A ring of 65,535 cells that hold 32-bit integers, as in the C# interpreter.
| Command | Does |
|---|---|
p n | Move left or right; the ends wrap |
i d | Add or take 1 |
w r | Print or read a character |
( ... ) | Repeat while the cell is not 0 |
; | Print the cell as a number |
'c \n | Write the character c or the number n |
"text" $ | Write a text or a line of input from the pointer on |
^ c | Go back to the first cell; clear every cell |
j % | Jump to the position in the cell; a random number |
Example
The greeting writes its question, goes back with ^ and prints it, then clears the memory and reads a name…
The greeting writes its question, goes back with ^ and prints it, then clears the memory and reads a name into the first cells with $. It writes Hello, one cell after the name, walks back to the empty cell between the two, and prints both. That works only if a string and $ leave the pointer after what they wrote. The specification does not say so, but its examples need it.
Patterns it teaches
- Turing tarpit: brainfuck underneath, with the shortcuts on top.
Further
See also
Brainfuck
Cell-based
Write your own in Run Convert a program from PNID
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: pnid.
Command line
shib run pnid -e '"Hello, World!"^(.n)'shib manual pnidSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/pnid.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org