esolang

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

Expected: Hello World!

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

CommandDoes
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.
Expected: What's your name? Ada
Expected: 42

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.

Expected: 3 bottles of beer! 2 bottles of beer! 1 bottles of beer! 0 bottles of beer!

Patterns it teaches

Further

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 derplang

Source

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