AnnoyingScript
A stack you write on at one end and read from the other.
AlmostGalactic, 2024 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
AlmostGalactic made AnnoyingScript in 2024, in Scratch. A program is one line of one-character instructions, most with a one-character argument; longer text goes in braces. Values pile up on a stack of strings, and a register called ~ holds the one value that tests and printing look at.
Read the story
The two ends of the stack do different jobs. + puts a value on the top, while ~, - and input work at the bottom. So a word built from letters comes out backwards, and the second Hello World reverses the stack before it joins it. Jumps go to a character index in the program, counted from 0.
The machine
| Instruction | Does |
|---|---|
+a +{text} | Put a value on the top |
_ | Read a line onto the bottom |
~ - | Copy the bottom into ~; remove the bottom |
< : | Reverse the stack; join it into one string |
>a >~ | Print a value or the register |
?a ... | | Run up to the | only if ~ equals a; ?!a if it does not |
!n | Jump to character n |
= @n | Make a variable from ~; the value of variable n |
&op | Do + - * / or % on the bottom two values |
# | Halt |
^ clears the output in the original. This implementation does nothing, because printed text cannot be taken back. $n picks a number from 1 to n from a fixed sequence, and ; waits no time.
Example
The second one puts eleven characters on the top, so they lie backwards.
The second one puts eleven characters on the top, so they lie backwards. < turns them round, : joins them, ~ copies the result into the register and >~ prints it.
The truth machine. On 1 it prints 1 forever, because !4 jumps back to the fifth character and runs >1 again.
The calculator reads an operator and two numbers into variables 1, 2 and 3, then works out @2 &@1 @3. A question asked with _ is not printed.
Patterns it teaches
- Stack machines: a stack with two working ends and a register.
Further
See also
Stack-based
Write your own in Run Convert a program from AnnoyingScript
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: annoyingscript.
Command line
shib run annoyingscript -e '_~>~' --input 'cat'shib manual annoyingscriptSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/annoyingscript.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org