Jot
Every string of bits is a program, including the empty one. A universal language with no syntax errors at all.
Chris Barker, 2001 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
Iota has two symbols, but not every string of them is a program: the *s and is have to balance. Chris Barker's second language, Jot, removes even that.
Read the story
A Jot program is any sequence of 0s and 1s. It is read one bit at a time, and each bit transforms the program-so-far into a new combinator. Nothing can fail to parse, because there is nothing to match.
That makes Jot a natural enumeration of programs. List all bit strings, shortest first, and you have listed every program, each exactly once.
The machine
The meaning [F] of a bit string F is built from left to right:
| Program | Means |
|---|---|
| (empty) | I, the identity |
F0 | [F] S K (apply the program so far to S, then to K) |
F1 | λx.λy. [F] (x y), which is S (K [F]) |
The result is a combinator. Like Iota, Jot has no input or output; you apply it to arguments and see what it reduces to.
Example
K is 11100, S is 11111000:
K is 11100, S is 11111000:
Now break K. Drop one bit, or add one:
All of them run. None of them is K. Dropping the last 0 turns "keep the first" into "keep the second": one bit, opposite behaviour. This is the whole lesson of Jot: every mutant is valid, but a valid mutant is not a similar one.
Patterns it teaches
- Every text runs: the purest example. The grammar is
(0|1)*. - Combinators: each bit is a tiny combinator transformation.
- Encoding tricks: listing bit strings lists programs, the kind of numbering that proofs about computability like to assume.
- Turing completeness: Barker shows that any SK term can be rewritten as a Jot string.
Try this
- What does the one-bit program
1do toa b? Work it out from the table, then run it. - Write a tiny loop that tries every Jot program up to 8 bits on
a band counts how many reduce toa(that is, act like K). How rare is K? - Hard: Barker's Zot adds input and output to Jot. Read about it and sketch how a bit string could print.
Further
- esolangs.org/wiki/Jot
- Chris Barker, "Iota and Jot: the simplest languages?" (2001).
- Lazy K accepts Jot as one of its syntaxes. Binary lambda calculus is another bit-level language, but there not every string is a program.
See also
Functional paradigm
Write your own in Run Convert a program from Jot
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: jot.
Command line
shib run jot -e '1110' --input 'a b'shib manual jotSource
- Module
langs/museum/ports.js- Interpreter
langs/museum/jot.js,langs/common.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org