'!@#$%^&*()_+'
The commands are the shifted number row of a keyboard. Every other character pushes itself.
Conor O'Brien · Turing complete: unknown · ●●○ moderate
Tested with 6 known programs · Hello World on Try It Online: identical · Test method
Run it
The idea
Conor O'Brien named this stack language after the twelve symbols above the digits on a US keyboard, and those twelve are almost all of its commands. Its TIO id, ecndpcaalrlp, is the first letters of their names: exclamation, commercial at, number, dollar and so on to plus. Any other character, a letter, a digit or a space, pushes its own code point. So a string is pushed by writing it backwards, and a Hello World is the text reversed with a print loop after it.
The machine
A stack of whole numbers of any size. It starts as one 0, and popping an empty stack gives 0.
| Code | Does |
|---|---|
! | Duplicate the top |
@ # | Pop and print as a character, as a number |
$ | Swap the top two |
% | Move the top to the bottom |
^ | Add one to the top |
& | Pop an index and move that item to the top; 0 is the bottom |
* | Add a character of input to the top, -1 at the end |
( ) | Skip past ) if the top is 0; ) always goes back to ( |
_ | Negate the top |
+ | Pop and add to the new top |
This implementation follows the D interpreter at github.com/ConorOBrien-Foxx/ecndpcaalrlp, which TIO runs. It also has = to copy an item by index and ? to print the stack.
Example
The first pushes a space and makes it a ! with ^, then the text backwards; the loop prints until it…
The first pushes a space and makes it a ! with ^, then the text backwards; the loop prints until it reaches the 0 at the bottom. The second adds the codes of A and B. The third is a cat: each character is stored one higher so that the end of input, -1, becomes 0 and stops the loop.
Patterns it teaches
- Stack machines: one stack, one loop.
- Every text runs: plain text is a program that pushes itself.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from '!@#$%^&*()_+'
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: ecndpcaalrlp.
Command line
shib run ecndpcaalrlp -e '3_#'shib manual ecndpcaalrlpSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/ecndpcaalrlp.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language