AHHH
AHHH (a programming language for the dreadful) is a Turing-complete, cell-based esoteric programming language inspired by the all-consuming dread induced by programming. It was written by Kyle Morgenstein in 2021 to allow for single "screams" ("AHHH" followed by sequences of uppercase and lowercase h's) to be interpreted as runnable code. The language is fairly simple and is based on COW and brainfuck, but with a few additional commands to make computation easier. AHHH has 16 (+2) commands, which are all the capitalization permutations of hhhh to HHHH. The start key is the sequence AHHH. The AHHH language has a memory head (pointer) which can be moved along a tape of memory. There are also two registers that values can be read/written from. Memory cells can be printed to the console. Anything that isn't a command is a comment. Loops can be formed with the HHHH and hhhh commands.
Language Mechanics
Code | Command | Function |
---|---|---|
0 | hhhh | Searching in reverse, skip the first preceding command, and then jump back to matching HHHH command and begin execution from that HHHH command (end loop). |
1 | hhhH | Move the pointer right one cell. |
2 | hhHh | Move the pointer left one cell. |
3 | hhHH | Print the current memory cell as an integer. |
4 | hHhh | If Register 1 is empty, copy the current memory cell to the register. Otherwise, write the Register 1 value to the current memory cell. |
5 | hHhH | If Register 2 is empty, copy the current memory cell to the register. Otherwise, write the Register 2 value to the current memory cell. |
6 | hHHh | Add the current memory cell to the value of Register 1 and store it in Register 1. The memory cell is unchanged. |
7 | hHHH | Add the current memory cell to the value of Register 2 and store it in Register 2. The memory cell is unchanged. |
8 | Hhhh | If the current memory cell is nonzero, print the cell as an ASCII character. Otherwise, read in an ASCII character from the console. |
9 | HhhH | Increment the current memory cell by one. |
10 | HhHh | Decrement the current memory cell by one. |
11 | HhHH | Read in an integer from the console and store it in the current memory cell (overwrites current cell). |
12 | HHhh | Set the current memory cell to zero. |
13 | HHhH | Double the value of the current memory cell and store it in the current memory cell. |
14 | HHHh | Square the value of the current memory cell and store it in the current memory cell. |
15 | HHHH | If the current memory cell is nonzero, continue to the next command. Otherwise, skip one command, and then skip ahead to the next matching hhhh command (begin loop). |
16 | AHHH | Start program. |
17 | hhh! | Print new line (useful after printing ASCII characters, which otherwise don't print a new line). |
Sample Code
An interpreter written in c++ as well as some demo files can be found here.
Because comments can be inserted directly, it is easy to write fairly well documented programs. For example, this program generates Fibonacci numbers:
AHHH start program HhhH increment cell 0 hhhH move to cell 1 HhhH increment cell 1 hhHh move to cell 0 HHHH start loop hhHH print cell hHhh copy cell to register 1 hhhH move to next cell hHHh add cell to register 1 hHhH copy cell to register 2 hHhh paste value from register 1 to cell hhHh move to previous cell hHhH paste value from register 2 to cell hhhh end loop
Alternatively, the language can be condensed and programs given as a single uninterrupted scream, as in this program that prints "Hello, World!" to the console:
AHHHHhhHHHhHHHHhHHHhHHhHHHhHHhhHHhhHHhhHHhhHHhhHHhhHHhhHHhhHhHhhHhhhhhhHHhhHHHhHHHHhHHHhHHhHhHHhhHhhhHhhHhHhHhHhHhHhHhhhhhhHhHhhHhhHH hhHHhhHHhhHhHhhHhhhhhhHhHhhhHhhHhhhhhhHhHhhhHhhHhhHHhhHHhhHHhhhhhhHHhhHHHhHHHHhHHHhHHhHhHhHHHhhHhhHHHhHHHHhHHHhhHHHhHhHHhHhHhHhHhHhHh HhHhhhhhhHHhhHHHhHHHHhHHHhHHhHHhhhhhhHHhhHHHhHHHHhHHHhHHhHHHhHhHhHHHhhHhhHHHhHHHHhHHHhhHHHHHhhHhhHHHhHHHhHHHhHhHHHhHhHHhHhHhhhhhhHhHh hHhhHHhhHHhhHhHhhHhhhhhhHhHhhhHhhHhhHHhhHHhhHHhhhhhhHhHhhHhHhHhHhHhHhhHhhHhhhhhhHhHhhHhHhHhHhHhHhHhHhHhHhHhHhHhHhHhHhHhhhhhhHHhhHHHhH HHHhHHHhHHhHHhhHHhhhhhh!