esolang

DerpScrp

Three strings and five commands. One of the strings is the console, and one is the program.

A, 2019 · Turing complete: unknown · ●○○ easy · esolangs.org

Tested with 6 known programs · Test method

Run it

Expected: HELLO

The idea

The user A made DerpScrp in 2019, after the syntax of DerpText. The machine has three strings. A is the console, B is a text the user types before the run, and C is the program. Each command is deleted from the front of C as it runs, so a program can append to itself, swap itself out, or run what the user typed.

Read the story

A command is its character followed by one or two parts, each ended by that same character. A part that is exactly A, B or C means that string. Anything else is a constant.

The machine

CommandDoes
&text&Append text to the console
+text+Append text to the program
=x=y=Swap x and y, or set x to y when y is a constant
>x>c>Remove every c from x
<x<c<Keep every c in x and nothing else

Other characters between commands are passed over. The specification shows the console again after every step and clears the screen each time. It is printed once, as the run leaves it, and B is the input.

Example

The first appends HxExLxLxO and then removes every x.
Expected: Hello, World!
Expected: hi

The first appends HxExLxLxO and then removes every x. The second is the greeting that extends its own program, written on one line. It appends &B& and &!& to the end of C and then runs &Hello, &, so the two new commands come last. The third swaps the program with the input, and the input runs.

Patterns it teaches

Further

Self-modifying

Write your own in Run Convert a program from DerpScrp

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: derpscrp.

Command line

shib run derpscrp -e '=A=B=' --input 'cat'
shib manual derpscrp

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/derpscrp.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org