Algebraic Semantics for Machine Knitting