derplang
A whole program on one line, so you scroll left and right instead of up and down.
JesseH, 2013 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
JesseH made derplang in 2013. The specification says the goal was a language that is somewhat confusing and hard to remember. Every command is two letters, and every command and every argument ends with a colon, so a program is one long line of tokens.
Read the story
It has variables, four sums, labels, a jump and three tests that jump one way or the other. The specification says any Minsky machine can be written with va, ad, su, go and eq, so derplang is Turing complete.
The machine
| Command | Does |
|---|---|
va:x:y: | Set x to y |
ou:x: | Print x |
ip:x: | Set x to a line of input |
co:z:x:y: | Set z to x and y joined |
ad su mu di with :z:x:y: | Set z to x + y, x - y, x * y or x / y |
la:x: go:x: | A label; jump to it |
eq gt lt with :x:y:j:k: | Jump to j if x = y, x > y or x < y, else to k |
An argument that names a variable stands for its value. Any other argument is its own text, so ou:Hello World!: prints the words. ou ends each print with a line feed. A jump to a number that is no label goes to that statement, counted from 1, and a jump to any other name that is no label ends the run.
Example
The 99 bottles starts x at 100.
The 99 bottles starts x at 100. Each turn takes 1 away and prints x and the words, and eq jumps back to start until x is 0. Then it jumps to END, a label the program never makes, and the run ends. Started at 4 it prints four verses.
Patterns it teaches
- Hostile design: made to be confusing and hard to remember.
- Counter machines:
va,ad,su,goandeqare enough for a Minsky machine.
Further
See also
Also in Hostile
Write your own in Run Convert a program from derplang
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: derplang.
Command line
shib run derplang -e 'ou:Hello World!:'shib manual derplangSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/derplang.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org