$_$
A command is one character, and its argument is how many times you repeat it.
Cortex, 2019 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 6 known programs · Test method
Run it
The idea
Cortex made $_$ in 2019 and named it after its first two commands, _ and $. It is said "sus". Every command is a run of one character, and the length of the run is the command's only argument, N. A run of 72 underscores appends the character with code 72, an H, to a string s, and $ prints s. & parts two runs of the same character. So Hello, World! is 1,143 characters long, and 1,129 of them are underscores.
Read the story
The specification is marked as a work in progress.
The machine
| A run of N | Does |
|---|---|
_ - | Append or prepend the character with code N to s |
$ | Print s, and empty it if N is odd |
? | Append the input to s |
+ | Append the text of call N-1, or the whole source if N is 1 |
. | Stop |
@ ! # | Make label N, point the newest label at call N, go to label N |
1 3 4 2 5 | Start miniprogram N, add a command to it, set that command's N, end it, run it |
* | Run s as a program |
% | Begin or end a comment |
z | Wait N seconds; this implementation skips the wait |
The specification also has ;, which prints the lyrics of a song N times. This implementation leaves it out.
Example
33 underscores make a !.
33 underscores make a !. The quine appends its whole source to s and prints it, and its % opens a comment that never closes. The label example makes label 1, points it at the fifth call, the ?, and jumps there past the first .. The last line builds a miniprogram from commands 9, 2 and 7 of the specification's table, counted from _ as 0. They are ?, $ and ., a cat, and 5 runs it.
The self-interpreter is ?*.. It reads a program and runs it, so given the Hello, World! it prints Hello, World!.
Patterns it teaches
- Encoding tricks: the argument is the length of a run.
- Code as data:
+copies the source into s and*runs s. - Quine: the cheating quine reads its own source.
Further
See also
Pattern-based
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: u24-20-24.
Command line
shib run u24-20-24 -e '?$.' --input 'cat'shib manual u24-20-24Source
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/u24-20-24.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org