Heck
A program is a hexadecimal number, so that the reader says "What the heck?!"
PixelatedStarfish, 2021 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
PixelatedStarfish made Heck in 2021, first thinking of it like Lenguage, where a number is turned into bits and run. What came out is a small stack language in which every operation is one hex digit. Seven of the sixteen take an argument of two more hex digits, so 648 is "push 0x48" and the 8 after it is "print". The specification shows each program with its parse, slashes between the codons, because the plain number is unreadable.
The machine
One stack of integers and labels numbered 00 to FF.
| Digit | Does |
|---|---|
0V 1V | Add V to the top, subtract V from it |
2L 3L | Jump to label L, mark label L |
4L 5L | Jump to L if the top is 0, if the stack is empty |
6V 7 | Push V, pop |
8 9 A | Print the top as a character, in decimal, in hex |
B C D E | Duplicate, shuffle, empty the stack, pop two and push the sum |
F | End |
Example
The Hello World from the specification, which parses as 648/8/645/8/64C/8/....
The Hello World from the specification, which parses as 648/8/645/8/64C/8/.... Each letter is pushed and printed, and the letters are capitals.
The truth machine pushes a 0, prints it, and jumps to the end because it is 0.
Further
Ideas it shows
See also
Stack-based
Write your own in Run Convert a program from Heck
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: heck.
Command line
shib run heck -e '6003009401200301'shib manual heckSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/heck.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org