All languages

Knitout notation

Machine-independent text format for low-level knitting-machine instructions: a generator emits operations on named needles and yarn carriers, and a per-machine backend turns the flat instruction list into control data.

Overview

Knitout (.k) is a line-oriented text format for low-level knitting-machine instructions, machine-independent by design. Design tools emit it and per-machine backends or simulators interpret it, replacing the hand-edited, machine-specific pattern files that programming knitting machines otherwise required.

Code

;!knitout-2
;;Machine: SWG091N2
;;Gauge: 15
;;Yarn-5: 50-50 Rust
;;Carriers: 1 2 3 4 5 6 7 8 9 10
;;Position: Right

inhook 5
tuck - f10 5
A header block, then one needle operation per line: direction, needle, carrier set. Needles and carrier sets compose freely, but the format holds no loops of its own — the Writer library generates them in JavaScript. The last tab shows its own idiom: implicit kickbacks the interpreter inserts, so colorwork needs no yarn-capture choreography.

Distinctive traits

  • A flat instruction list without flow control: the emitting tool unrolls loops and textures, so it is a domain-specific notation, not a general language.
  • Interpreter-inserted kickbacks keep carriers clear of the yarn, so colorwork needs no capture choreography; the miss opcode overrides it.
  • Beds, sliders, and racking are named symbolically, so one file can face different V-bed machines through different backends.
  • ;!source: comments tie each operation to the frontend line that emitted it, so a simulator reports errors at the design-tool location.
  • Extension x-* opcodes and X-* headers carry vendor settings like stitch number or presser mode; readers warn on ones they lack.
  • Generators such as the 3D machine-knitting compiler emit knitout; backends must act "as if" each stitch ran in written order, however they pack passes.

Status

The specification stands at version 0.6, public domain since the 0.4 rewrite, and is maintained by Carnegie Mellon's Textiles Lab. A JavaScript writer and several research compilers use it as their low-level output.

Sources & references