All languages

Piet language

Esoteric language whose programs are bitmaps of coloured blocks: hue and lightness transitions encode commands, block size encodes integers, and the pointer walks the image. Named after Piet Mondrian.

Overview

Piet is an esoteric visual language whose source code is a bitmap: blocks of colour called codels, walked by a pointer, where the change of hue and lightness between blocks selects the command. It exists to make the program itself an abstract painting — Morgan-Mar named it for Piet Mondrian — while staying computationally universal.

Code

Piet has no textual syntax, so the tour shows the language in its own terms: the 20-colour palette and the table that gives those colours meaning, the stack holding every value, and two gallery programs. There is no abstraction tab because there is no call, definition or name to abstract with. Each program was run under npiet to confirm its output.

A colour alone means nothing: what fires a command is the change to the next block, counted forward round two cycles — hue red → yellow → … → magenta, and lightness light → normal → dark (wrapping: “light is one step darker than dark”). One hue step is add, one lightness step is push, two of each is not. Values come from block size, so numbers must be drawn.

The table is the whole instruction set: six hues × three lightnesses cycle (red → yellow → … → magenta, light → normal → dark), while black and white sit outside both cycles, so a command is always a delta between two blocks. Hello World shows size-as-data — the red field is 72 codels, so push leaves 72 and out(char) prints H. The artistic version prints the same text from a picture that reads as an abstraction, the idiom the gallery is built on. No fourth tab exists because there is no fourth capability: with no call or definition, everything is spelled out in the program's own geometry. Images are redrawn from the gallery originals, which stay authoritative.

Distinctive traits

  • Colour transitions, not colours, are the instruction set: the hue and lightness deltas between consecutive blocks select one of 17 commands.
  • Block size is the only literal: a block's value is its codel count, so numbers must be drawn, and negative ones computed.
  • Flow is geometry: a direction pointer and codel chooser pick the next block, black blocks redirect, and white blocks cross without executing. Like Befunge, the picture is the control flow.
  • No abstraction: nothing can be named or called, so a repeated computation is copied into the picture, and programs grow with their repetition.
  • Turing-complete on an unbounded stack of unbounded integers — the spec's own conditional — and a brainfuck interpreter written in Piet demonstrates it.

Status

Morgan-Mar maintains the specification, preferring clarifications to an authoritative implementation, so interpreters differ in detail. npiet, the C interpreter, is still released (1.3h, 2026); editors, encodings and compilers exist, and gallery programs keep appearing.

Sources & references