esolang

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

Expected: prints: a

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:

ProgramMeans
(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:

Expected: prints: x z (y z)

Now break K. Drop one bit, or add one:

Expected: prints: b
Expected: prints: S x y
Expected: prints: S x (K x)

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

  1. What does the one-bit program 1 do to a b? Work it out from the table, then run it.
  2. Write a tiny loop that tries every Jot program up to 8 bits on a b and counts how many reduce to a (that is, act like K). How rare is K?
  3. Hard: Barker's Zot adds input and output to Jot. Read about it and sketch how a bit string could print.

Further

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 jot

Source

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