Phoneboard
A language you could type on a phone, with ten digits, a star and a hash.
2022 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Phoneboard, from 2022, uses only the twelve keys of a telephone. Each key is one command on a stack of whole numbers, and 4 switches to a second stack. There are no digits as numbers. 1 and 2 push 1 and 2, and every other number is built from them with 3, which adds, 0, which subtracts, and 8, which duplicates.
Read the story
Every command takes what it uses off the stack. That holds for the loop too, # ... *, which runs while the top two numbers are equal and drops them each time it looks.
The machine
| Key | Does |
|---|---|
1 2 | Push 1 or 2 |
3 0 | Add; subtract, the top minus the one below |
7 8 | Swap the top two; duplicate the top |
6 | Rotate the top three, the third to the top |
4 | Switch to the other stack |
5 9 | Read a character; print the top as one |
# * | Loop while the top two are equal |
The specification names 6 only ROTCCW. This implementation reads the end of input as 0.
Example
The truth machine adds twelve fours, each one 2 plus 2, to get 48.
The truth machine adds twelve fours, each one 2 plus 2, to get 48. Then 120 makes 2 minus 1, and adding that gives 49, the character 1. It echoes the input and loops while the input equals 49. On 0 that is one 0; on 1 it prints 1 forever.
The last one doubles with 83 and adds 1 with 13, one binary digit at a time. 72 is 1001000 in binary, and 105 is 1101001.
Further
Ideas it shows
See also
Stack-based
Write your own in Run Convert a program from Phoneboard
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: phoneboard.
Command line
shib run phoneboard -e '22322332233223322332233223322332233223322332233120388589#9888*' --input '0'shib manual phoneboardSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/phoneboard.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org