PNPL
Every program is a natural number, and the primes in it are the instructions.
Henry, 2025 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Henry made the Prime Number Programming Language in 2025, as a revised version of an earlier language called pirho. It rests on the fundamental theorem of arithmetic. Every whole number above 1 is one product of primes, so a number can stand for a list. Take the primes in order, 2, 3, 5, 7 and on. The power of the first prime is the first command, the power of the second is the second command, and so on.
Read the story
The eight commands are brainfuck's, so every brainfuck program has a number and the language is Turing complete. The numbers grow fast. The Hello World has 929 digits and its pi program has 5,853.
The machine
| Power | Brainfuck | Does |
|---|---|---|
| 0 | Nothing | |
| 1 | > | Move right |
| 2 | < | Move left |
| 3 | + | Add 1 to the cell |
| 4 | - | Take 1 from the cell |
| 5 | [ | Jump past the matching 6 if the cell is 0 |
| 6 | ] | Jump back to the matching 5 if the cell is not 0 |
| 7 | , | Read a character |
| 8 | . | Print the cell |
The number is divided by 2 as often as it goes, then by 3, then by 5, until 1 is left. A prime that goes in more than 8 times makes it no program at all. Cells are bytes that wrap, and reading past the end of the input gives 0.
Example
,.
,. reads a character and prints it. That is 2 to the 7th times 3 to the 8th.
The cat ,[.,] is 2 to the 7th, 3 to the 5th, 5 to the 8th, 7 to the 7th and 11 to the 6th.
++++[>++++++++<-]>+. multiplies 4 by 8, adds 1 and prints the 33, which is an exclamation mark. Twenty commands make 92 digits.
The three programs run. Hello World prints Hello World! and a line feed. The squares program, from Daniel B Cristofani, prints the squares from 0 to 10000, one to a line, in 1.4 million steps. The pi program, from Felix Nawothnig's yapi.b, prints 3.14070455282885 in 3.7 million steps. A run stops after a million steps, so both need more with --steps.
Patterns it teaches
- Encoding tricks: a program as the exponents of one number.
- Turing tarpit: brainfuck, one prime at a time.
Further
- esolangs.org/wiki/PNPL
- Brainfuck, the language underneath.
See also
PNPL builds on Brainfuck.
Brainfuck equivalents
Cell-based
Write your own in Run Convert a program from PNPL
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: pnpl.
Command line
shib run pnpl program.txtThe program is long; save it as program.txt first.
shib manual pnplSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/pnpl.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org