Every text runs
A language with no syntax errors. Whatever you type, or whatever a mutation produces, is a program that runs.
●○○ easy · where to see it
The idea
Most languages reject most texts. Type a random line into a C compiler and you get an error, not a program. That is good for humans, who want mistakes caught. It is terrible for evolution, where mistakes are the only source of new ideas. If almost every change is fatal, almost nothing can be tried.
Read the story
Some languages accept every text, or nearly every one. They get there in a few ways.
- Ignore what you don't understand. Brainfuck treats every character outside its eight as a comment. Whitespace ignores everything except space, tab and newline.
- Make every symbol mean something. In Jot (Chris Barker, 2001) every string of 0s and 1s, even the empty one, is a valid program. In Tierra and Avida, every possible instruction code is a real instruction.
- Make failure harmless. In Push an instruction that lacks its arguments does nothing. In Befunge-98 an unknown instruction reverses the pointer instead of crashing. bff stops a program at an unmatched bracket rather than rejecting it.
There is a second half; runs should also mean stops. A text that loops forever is no better than a crash for a system that needs the result. So these systems add step limits.
How it works
Brainfuck almost has the property.
Brainfuck almost has the property. The eight commands always work; only [ and ] can fail, when they do not match. The table counts 100,000 random strings of each length over the eight commands.
| Length | Brackets balanced |
|---|---|
| 10 | 14.6% |
| 20 | 5.9% |
| 50 | 1.7% |
| 100 | 0.7% |
So a random 100-command Brainfuck string is a valid program less than 1% of the time. Two rules fix it, and real systems use one or the other. Treat an unmatched bracket as "stop here" (bff), or skip it.
Some languages have the property completely. In Jot, every string of 0s and 1s is a program, the empty string included.
Why it matters for evolution: neutral networks. If most mutations are harmless, a population can drift through many different texts that all still work. Biologists call such a connected set of working variants a neutral network (from studies of RNA folding in the 1990s), and Motoo Kimura's neutral theory (1968) argued that much of molecular evolution is this kind of drift. Drift is not wasted; it carries a population to places where one more mutation does something new. A language where every text runs is a wide, flat landscape to drift across. A language with strict syntax is a landscape of narrow ridges.
Seen in
- Brainfuck. Everything except unbalanced brackets.
- Jot. Every bitstring.
- Whitespace. Non-whitespace is ignored, but a bad whitespace command is still an error.
- Befunge. Every grid of characters is a program; Befunge-98 reflects on unknown instructions.
- bff. All 64-byte tapes run, with a step limit.
- Tierra, Avida. Every instruction code is valid, chosen so that mutations are survivable.
- Push. Any nested list runs; missing arguments mean no-op.
- Thue. A counterexample. A program needs its
::=line to separate the rules from the starting string.
Try this
- Write a Brainfuck interpreter that treats an unmatched
]as "do nothing" and an unmatched[as "stop". Is every text now a program? - Take a working Brainfuck program, change one random character, and run it. Repeat 20 times. How many of the changed programs still print the same thing?
- Hard: design a tiny language with loops where every string runs and every run terminates.
Further
- esolangs.org/wiki/Jot
- Andreas Wagner, Robustness and Evolvability in Living Systems (2005), on neutral networks.
- See also artificial life, open-ended evolution, encoding tricks.