'96'
Every printable character is a command, so every text is a program. The only way out of a loop is an error.
Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
96 is named after its 96 commands, the printable ASCII characters 32 to 126 and the line feed. No command takes an argument and nothing is a syntax error. The specification says it is still meant to be usable, and it is Turing complete; brainfuck's [ and ] become [-+ and ];.
Read the story
Control flow comes from errors. ( causes an error when the accumulator is not 0, ; always causes one, and an error skips ahead to the next ; or ) at the same depth. So (left;right) is an if and else, and a loop [...] that never stops on its own ends when something inside it fails.
The machine
There are 26 arrays a to z of whole numbers of any size, never below 0, and one accumulator, ACC.
| Command | Does |
|---|---|
+ - . 0...9 | Change the current element; a digit appends itself |
@ ~ | Copy ACC into the element; swap them |
a...z , ' | Go to an array's first element, the next, the previous |
# _ | Go to the element numbered by this one; to the first 0 |
^ \| space : | ACC plus 1, minus 1, 0, the element |
& = * / % | ACC with the element; = is the distance, 0 when equal |
\ ` | The element divided by ACC, and the remainder | |
< > | 0 when ACC is less or greater than the element, else 1 |
? " $ | Read a line; print the array as text; print ACC and a space |
[ ] | Set a mark; go back to the last mark |
| line feed | Go back to the last mark and remove it |
A...Z | Set a mark and run the text after the letter's first occurrence |
! | Run the command whose code is in ACC |
( ; ) | Error if ACC is not 0; error; nothing |
Some commands also fail, - / % on an element of 0, \ ` | when ACC is 0, and ' on the first element. A function is a line in a comment between two ; at the start, called by its capital letter and ended by its line feed.
Example
A Hello World puts the codes in a and prints them with ".
A Hello World puts the codes in a and prints them with ". Its second line is a comment.
The factorial reads n into ACC, puts it in the element and keeps 1 in ACC. The loop multiplies and counts down until - fails on 0; the error skips to ;, and $ prints the product.
A line feed goes back to the last mark and removes it, so three marks and a line feed run the rest of the line 2 times 2 times 2 times.
A quine counts the same way. Five [ print 32 numbers from a, each after a comma, and the last line prints a as text.
The specification also has Fibonacci numbers, +[&~$], and two programs that print the primes for ever.
Patterns it teaches
- Every text runs, as nothing is a syntax error.
- Turing completeness, shown by translating brainfuck.
- Quine, with data and then code that prints the data twice.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from '96'
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: 96.
Command line
shib run 96 -e '?+~[-+*-];$' --input '5'shib manual 96Source
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/96.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org