All languages

woving languageexperimental

A pattern language over loom drafts: a draft's threading and treadling are long numeric sequences, and woving's operators expand repetition, step arrays, symmetry, and random variation into them.

Overview

woving is a domain-specific pattern language for loom drafts, describing itself as a notation system for "concise loom draft instructions". A draft's threading and treadling are sequences of shaft numbers; woving adds operators for the regularities weavers apply by hand.

Code

The grammar accepts one expression and no comment or newline, so each tab below is annotated pseudocode: the comment lines explain, and only the plain expression lines are fed to the parser, one per run. Annotations are outside the language.

; shafts are the digits 1-9 plus a-f — no 0 — so fifteen indices fit
2341
; hex letters stand for shafts 10 to 15, keeping one character apiece
8caf
; two runs written side by side concatenate
2341 2341
Read the operators as moves a weaver already makes: 1:4 is four picks of shaft 1, /141/ walks up and back down, | and ! mirror a run even or odd, 1? keeps or drops it. The grammar is a Nearley file, so the language is exactly its postfix and : forms — no bindings, no flow control, and no comments or newlines, which is why each expression above must be parsed on its own.

Distinctive traits

  • A draft's long numeric sequences collapse into one expression, which the evaluator expands back to indices.
  • Postfix operators carry weaving's own regularities — repeat :, step /,/, mirror |, and !, which mirrors without repeating the pivot (point symmetry).
  • Hexadecimal letters index shafts 10 to 15, so a 15-shaft draft keeps one character per position (the grammar has no 0).
  • Groups nest and concatenate, so one shared prefix can open a block of related runs.
  • The grammar is eight nonterminals in woving.ne, so the whole language is auditable in a screenful.

Status

Published to npm as woving (MIT) starting July 2023, currently at 1.3.0. The README calls it "a work in progress", with one author. Unlike Knitout, which drives knitting needles, woving writes the shaft and treadling sequences of a loom draft.

Sources & references