esolang

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

Expected: Hello, World

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

InstructionDoes
+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
!nJump to character n
= @nMake a variable from ~; the value of variable n
&opDo + - * / 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.
Expected: Hello World

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.

Expected: 0

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.

Expected: Calculator 42

Patterns it teaches

Further

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 annoyingscript

Source

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