Wierd

From Esolang
Jump to: navigation, search

Wierd is a graphical language developed by Chris Pressey, Ben Olmstead, and John Colagioia, in 1997.

Etymology[edit]

The name "Wierd," commonly mistaken for a spelling error or a typo, actually comes from a fusing of the words "weird" and "wired." It is often pronounced like the English word "wired", but with extra stress or lengthening of the diphthong, so that it sounds more like "why-eared".

Syntax and Semantics[edit]

In Wierd, there are only two symbols: whitespace and everything else. Non-whitespace characters are followed in lines (starting in the top left corner, going southeast), and when a turn needs to be made to keep on the line, an instruction is executed, based on the angle that the turn required. In the following table, from the spec, it is not clear if these angles are meant to be turns to the left (counterclockwise) or to the right (clockwise); however, the first interpreter running on the first example program suggests that they are turns to the left.

  0 degrees     NO:  No operation, continue as normal.
 45 degrees     P1:  Push a data value of 1 onto the stack.
 90 degrees     IF:  Pop the stack.  If the value is zero, continue
                     executing as normal.  If the value is nonzero,
                     however, reverse direction.
135 degrees     GP:  Pop the stack.  If the value is zero, pops the next
                     two items from the stack, retrieves (gets) the
                     value stored at the coordinates specified by these
                     values (x, then y), and push it onto the stack.  If
                     the first value was nonzero, however, takes the
                     value stored below the coordinates on the stack,
                     and stores (puts) it at the coordinates.
180 degrees     QU:  Jump the gap, if possible.  Otherwise, terminate.
225 degrees     IO:  Pop the stack.  If the value is zero, read a
                     character from input, pushing it onto the stack.
                     If the value was nonzero, pop the stack, and print
                     the value to output as a character.
270 degrees     IF:  See 90 degrees.  Included for flexibility.
315 degrees     SB:  Subtract the top of the stack from the value
                     beneath it, popping both values, and pushing the
                     result.

(from the Wierd spec).

According to John Colagioia, it was not supposed to be legal to cross wires, but several Wierd programs are in circulation that rely on this.

Wierd was inspired by Brainfuck and Befunge.

External resources[edit]