Piet (programming language)

Piet is an esoteric programming language in which the program code looks like an abstract picture. It was invented by David Morgan -Mar and after Piet Mondrian, a pioneer of abstract art, named. The example program above right is from the word " Piet ". It is quite typical in its artificial appearance; Morgan -Mar had set itself the goal of the appearance of popular Mondrian images ( for examples, see Related links) to get close.

Like most other esoteric programming languages ​​is Piet without immediate practical benefits, but is treated in academic computer science education as an example of unusual language concepts.

Implementation

Technically, Program Code are in the form of an image file in GIF format. Piet is an interpreted language, which means the Piet interpreter reads the contents of the file (in this case an image file ) with the source code a bit and interprets the information contained therein as program instructions.

The smallest semantic unit in such an image file is a " Codel " ( combination of " code" and "pixel "), a - in the visual representation as an image - square of n2 pixels of the same color. This value n is the Piet interpreter passed as a parameter and chosen for the visual representation of Piet programs so that a visually appealing ( not too small ) image results. In the examples to the right, n is 4 (top) and 11 (bottom).

The Piet programming language based on stack operations. It is not Turing-complete, since it can be randomly accessed only on a limited part of the stack ( limited by the size of the tape alphabet). The program flow is controlled by two pointers - visually interpreted - lead on a winding path through the image plane with the Codels. Syntax elements are then, for example,

  • Entering into a black or white color box
  • The number of Codels a cohesive color surface,
  • The transition from one color to another.

These ( and other ) language elements encode the typical stack operations such as push and pop as well as arithmetic operations and those for the input and output of characters.

839075
de