DeathScript
Three variables, seven commands and not a single jump. Every line runs once.
YourDeathIsComing · Turing complete: no · ●○○ easy · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
YourDeathIsComing made DeathScript around three variables, A, B and C. Arithmetic only ever reads B and C and only ever writes A, so a calculation is a matter of moving values into place with switch. There are no loops and no conditions, so every program ends after its last line.
Read the story
The reference is a Windows batch file, and this implementation follows it. Where cmd itself gets in the way, as with a ! in the text, which echo drops there, this implementation prints what the specification means.
The machine
| Command | Does |
|---|---|
output text | Print the text |
outvar V | Print the value of V |
input V | Read a line into V |
set V x | Set V to x, or to a random number from 0 to 32767 with random |
math op | Put B and C worked by add, sub, mul, div or mod into A |
switch V | Swap A with B or C |
clear | Clear the screen |
Each value starts at 0 and the arithmetic is on 32 bit whole numbers, as the batch file's set /a does it. Every printed value ends its own line, as echo does.
Example
The Hello world and its cat.
The Hello world and its cat.
To multiply, the two numbers go into B and C and the product comes out in A. Division cuts toward 0, and switch brings the 7 back from B.
Further
See also
Also in Jokes
Write your own in Run Convert a program from DeathScript
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: deathscript.
Command line
shib run deathscript -e 'input A
outvar A' --input 'meow'shib manual deathscriptSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/deathscript.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org