Argh!

From Free net encyclopedia

Argh! and Aargh! are fungeoid esoteric programming languages (i.e. languages deliberately designed to be strange, with utility not an objective).

Argh! and Aargh! share a two dimensional layout. Both are limited to 80 columns wide but while Argh! is also limited to 40 rows, Aargh! has unlimited number of rows. Each command is a single character and occupies one cell of the grid; a cell can alternately contain a value. The language also supports a stack of theoretically unbounded size. There are 27 documented commands.

The following program prints out "Hello, Wikipedia!":

j       Wikipedia!
lpppppppPPPPPPPPPPq
 Hello, 

Explanation of the above program: execution begins with the j in the top row leftmost column, which indicates the starting direction of execution is down. The next command executed is the l which means process commands to the right. Each p indicates that the value below it should be printed; each P that the value above it should be printed. The q (for quit) command marks the end of the program.

A program that tries to execute a value that is not a command, or that tries to execute outside the grid, emits the language's standard error message, Argh! or Aargh! as appropriate, and terminates.

Commands

Each valid instruction in Argh! and Aargh! consists of one ASCII character. The can be classified as:

  • Unconditional flow control. There are 4 commands that specify which direction (left, down, up or right) instruction processing should proceed in.
  • Conditional flow control:
    • Jump to the next cell, in a specified direction, that has the same value as the top of the stack, and begin processing in that direction.
    • If value on top of stack is positive turn direction execution 90 degrees right; another command turns 90 degrees left if top value of stack is negative.
  • Stack operations:
    • Push value of cell above (or below) execution onto stack.
    • Duplicate top value of stack.
    • Pop and discard from stack.
    • Add/Subtract value in cell above/below this command to top of stack.
    • Pop value from stack and store in cell above/below this instruction.
  • Input/output:
    • Send value in cell above/below instruction to standard output.
    • Store byte from standard input in cell above/below this instruction.
    • Store system EOF in cell above/below this instruction.
  • End execution.

External links