From Esolang
Jump to: navigation, search

Argh! and its successor Aargh!, both invented by Sascha Wilde, are Befunge-like esoteric programming languages, laid out in two dimensions. Each is limited to 80 columns wide, but Aargh! has an unlimited number of rows, whereas Argh! is limited to 40. The idea was to make sure Aargh! was Turing-complete.

Each character of the grid is either a one-cell wide command or value. The language also supports a stack of unbounded size. It has 27 documented commands.

The following program prints out "hello, world":

j       world
 hello,      *  j

Execution begins with the j in the top left corner, which indicates the starting direction of execution is down. The next command is an l, which means process commands to the right. Each p indicates that the value below it should be printed; each P indicates that the value above it should be printed.

The next part is more interesting: the goal is to output a linefeed (ASCII value 10, often written as "\n"). This special character has to be generated: the s stores the character below ("*", ASCII 42) on the stack, the r reduces the value on the stack by the value of the character below (42 minus " ", ASCII 32, is 10), the f fetches the top value from the stack and inserts it below, so the cell below the f will hold the value 10, which is ASCII linefeed. The following j lead us down (we already know this) and the h sets the execution direction to go left and the P finally prints the linefeed. The q (for quit) command ends the program.

A program that tries to leave the grid or execute a value that isn't a command causes the language's standard error message, "Argh!" or "Aargh!" as appropriate, to be emitted, followed by the program terminating.

External resources[edit]