HakerScript
A program starts with two commands, install and uninstall. Everything else is a package you install first, and every variable is named like an IP address.
Provitia, 2021 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Provitia made HakerScript in 2021 for an esolang jam, meant to be confusing and readable at the same time. A program starts with nothing but install and uninstall. Printing needs install "show", a jump needs install "goto", and uninstall can remove any command, install itself included. Variables are set with bruteforce and read back with ping, and their names must be IPv4 addresses such as 127.0.0.1.
Read the story
The only branch is check. Unless its value is 0 it jumps to twice its own line number, so programs pad themselves with empty lines to land on the right one.
In the specification an install takes 4 seconds and a bruteforce 1 to 5. Both also print a log, but the specification does not give its text. This implementation leaves out the logs and the pauses, and nothing else.
The machine
| Package | Does |
|---|---|
show v | Print a value, with no line break |
newline | Print a line break |
input inputstr | Read a line as an integer or as a string |
bruteforce a.b.c.d v | Set a variable |
ping a.b.c.d | Give a variable's value |
sum v | Add v to the last value bruteforce set |
negate n | Give -n |
goto n | Jump to line n |
check v | Unless v is 0, jump to twice this line's number |
silence | Turn the logs off or on |
turtlejam | Write numbers as turtle repeated, and 0 as noturtle |
An argument can be another command, whose result it takes. A jump outside the program ends it.
Example
The truth machine.
The truth machine. On 1, check on line 9 jumps to line 18, which goes back to the loop on line 11 that prints 1 forever. On 0 it falls through to goto 9999, which is past the end, so it stops after the prompt.
The 99 bottles of beer counts down the same way. Line 10 checks the count and jumps to line 20 while it is not 0. To take one down it bruteforces -1 into 255.255.255.255, so that sum adds -1 to the count.
Patterns it teaches
- Hostile design: every command has to be installed before use, and the only branch doubles the line number.
Further
See also
Also in Hostile
Write your own in Run Convert a program from HakerScript
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: hakerscript.
Command line
shib run hakerscript -e 'install "show"
show "Hello world!"'shib manual hakerscriptSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/hakerscript.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org