Platts
A 2-tag system that can talk. Cut two symbols off the front, put one production on the end, and let some productions show on the screen.
Quintopia, 2008 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
Quintopia devised Platts in October 2008. The name stands for Programming Language for Arbitrary Two-Tag Systems, and it adds input and output to them. A 2-tag system keeps a string. Each step reads the first symbol, deletes it and the symbol after it, and appends that symbol's production to the end. It stops when the string is empty. 2-tag systems can compute anything, so Platts can too.
Read the story
Output is a mode. A rule written with > switches it on or off, and while it is on every other production is printed as well. A rule written with ! empties the string. A production can hold {input}, which becomes a character of input.
The machine
A program is a count n, then n rules, then the start string.
| Rule | Does |
|---|---|
A\|text | A produces text |
A>text | A produces text and switches output on or off |
A!text | A empties the string, then produces text |
A symbol without a rule produces nothing. This implementation runs the Python 2 interpreter as written. It reads one line of start string, with its line feed when there is one, and that line feed is a symbol too. Every {input} in one production becomes the same byte. Because the interpreter sets the symbol size back to 1 for each rule, only a program with a single rule can have symbols longer than one character.
Example
Hello World.
Hello World. A switches output on, and B prints its text and puts it on the string. The H at the front of that text switches output off again and adds a K, which comes round later and stops the run.
The cat goes round A0B0C0. A switches output on, B reads a byte and prints it, and C switches output off and puts the round back on the end. The byte read and the 0 after it are then cut as one pair. At the end of the input B produces nothing, the 0 at the front of the next round is read as a symbol, and 0! stops the run.
With a line feed after A0B0C0 every symbol shifts by one. The first byte read is cut as the partner of the line feed, the 0 reaches the front at once, and the cat stops after one character.
Patterns it teaches
- Tag systems: a 2-tag system, with output switched on and off by the rules themselves.
- Turing completeness: the 2-tag systems underneath are universal.
Further
See also
Also in Rewriting
Write your own in Run Convert a program from Platts
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: platts.
Command line
shib run platts -e '4
A>
B|Hello World!
H>K
K!
A0B0'shib manual plattsSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/platts.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org