LOOM Studio

LOOM is a tiny language for describing woven cloth. Vertical warp threads are each tied to a shaft; every pick lifts some shafts and throws a horizontal weft thread across. Raised warp shows on top, everything else shows the weft color. Write a program, press Run, and watch it weave.

Ctrl+Enter runs
shuttle (weft being thrown) ▲ raised warp on this pick

Top band: each warp thread's color, with the shaft it is threaded on. Arrows mark the threads lifted for the current pick; the weft passes under them and over the rest.

Each step is one executed statement (statements inside repeat appear once per pass). The yellow bar in the editor marks the statement just executed.

ProgramResult

Each program is run live in this page by the same engine used by cli.js, and its output compared character-for-character to the expected output.

A LOOM program is one statement per line; // starts a comment.

  • loom 24 16 — width (warp threads) and height (picks). Must come first.
  • palette a=#1b3a5c b=#f2e8cf — one-letter color names.
  • warp a b*3 (a b)*2 mirror(a b c) — warp colors, repeated across the width.
  • thread 1-4 or thread mirror(1-4) — which shaft (1–8) each warp thread hangs on.
  • treadle 1 12 — name a lift: treadle 1 raises shafts 1 and 2.
  • pick b 13, pick b t1, pick b *, pick b -, pick b !1 — weave one row with weft color b.
  • shuttle r o y then pick 1 — picks without a color take the next shuttle color.
  • cross 2 5 swaps two warp threads; drift 1 / drift -1 rotates all of them.
  • maxfloat 3 — error if any thread floats over more than 3 others (the cloth would be loose).
  • repeat 4 { … } — repeat a block.

Output is a grid of color letters; . marks rows never woven. The first error stops the program and is reported as error line L: message.