Z
A whole language in two letters. Hello World is eleven lines of z.
Challenger5, 2016 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Challenger5 made Z in 2016. A program uses only z, Z, the space and the line feed. A word is one to three letters, a statement is words parted by one space, and statements are parted by a line feed or by two spaces. The case of each letter matters.
Read the story
Under the letters is a small assembly. There is one number, A, a grid of numbers and a pointer into the grid. The specification calls it a preparing system. Most statements put a number in A first, and the next statement uses it.
The machine
| Statement | Does |
|---|---|
z | Read a number into A |
Z | Print A |
zz z and digits | Set A to a number, one word per digit |
zz Z | Set A to the cell at index A |
zZ | Move the pointer to A |
Zz | Put A in the cell at the pointer |
ZZ z ZZ Z | Add A to that cell, or take A from it |
zzz | Jump to line A |
zzZ | Jump to line A if the cell at the pointer is 0 |
The digits are z 1, Z 2, zz 3, zZ 4, Zz 5, ZZ 6, zzz 7, zzZ 8, zZz 9 and zZZ 0, so zz z zzz Z sets A to 72. Lines count from 1. The specification says its Hello World prints ASCII values, so Z prints A as a number, one per line.
Example
The truth machine reads a number into the cell at the pointer.
The truth machine reads a number into the cell at the pointer. If it is 0, zzZ jumps to line 4, which prints 0. Otherwise line 3 prints 1 and jumps back to itself forever. The Fibonacci program is included too. It keeps two cells and adds each into the other, and it prints 0 twice before 1, 1, 2, 3, 5.
Further
Ideas it shows
See also
Also in Turing tarpits
Write your own in Run Convert a program from Z
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: z.
Command line
shib run z -e 'z Z' --input '42'shib manual zSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/z.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org