HS
Three characters, the hash, the space and the colon. A word is a run of hashes, and its length is its meaning.
2023 · Turing complete: no · ●●○ moderate · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
HS is from 2023. It has if, two kinds of loop, comparisons, variables and print, and it spells all of them with one character. A word is a run of #, and the number of hashes says which word it is. Three hashes end an if, thirteen are the digit 2 and twenty-nine are the eighth variable. Spaces part the words, and the only other character is :, which reads a number.
Read the story
There is no arithmetic, so a variable only ever holds a number written in the program or read from the input.
The machine
| Hashes | Word |
|---|---|
| 1, 2, 3 | if, then, end if |
| 4, 5 | loop that many times, end loop |
| 6, 7 | loop forever, end loop forever |
| 8, 9, 10 | >, =, < |
| 11 to 20 | the digits 0 to 9 |
| 21 | |
| 22 and up | variable 1, variable 2 and so on |
Digits in a row make one decimal number. Print writes a variable as the character with that code and a number as its digits. The specification leaves some things open. This implementation counts line breaks as spaces, a variable never set is 0, and the program ends when : finds no input left.
Example
Print, then the digits 4 and 2, writes the number 42.
Print, then the digits 4 and 2, writes the number 42.
The first example sets variable 1 to 45, checks that 1 = 1 and prints the variable. 45 is the code of the minus sign.
The counting asterisk printer reads a number into variable 1 and sets variable 2 to 42, the code of *. Then it loops variable 1 times and prints variable 2.
The truth machine runs in a loop forever. On 0 it prints 0 and reads again, and the end of the input ends it. On 1 it falls into an inner loop that prints 1 without end.
Patterns it teaches
- Encoding tricks: every keyword, digit and name is a count.
- Hostile design: the eighth variable is twenty-nine hashes in a row.
Further
See also
Also in Hostile
Write your own in Run Convert a program from HS
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: hs.
Command line
shib run hs -e '###################### #########
############### ################
# ############ #########
############ ##
#####################
######################
###'shib manual hsSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/hs.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org