Weft-8 · compare

one job · three machines · five jobs in all

Which part is the
computer, and which
part is the language?

Write the same small job for the Loom's Weft-8, for x86-64 and for AArch64, and the answer becomes obvious: the loop, the compare, the branch and the load are the machine. Everything you thought was programming is mostly naming.

specimen 03 · the greater of two
CMP R1, R2          cmpl  %ebx, %eax     cmp   w0, w1
JG  big             jg    .big          b.gt  .big
MOV R3, R2          movl  %ebx, %ecx    mov   w2, w1
HLT                 jmp   .done         b     .done
weft-8x86-64aarch64

Five jobs, three machines

Add two numbers. Sum 1 to 5 with a loop. Pick the greater of two. Store a value and read it back. Multiply by four. Nothing here needs a library, a framework or a runtime — and that is the point.

Weft-8

The Loom's machine: 16 registers, 27 two-byte opcodes, 256 bytes. This column is executable — the page runs it and the tests assert the result.

x86-64

The machine under most laptops. Hand-written illustrations of the same job, labelled as illustrations rather than passed off as compiler output.

AArch64

The machine in most phones. Same job again — and the closest of the three to the Weft-8 in shape, because both keep their flags in one place.

What you notice after four examples

the weft-8 family — one machine, seven faces

the Loomthe machine and its editor — where it all starts Weft Puzzlesfive puzzles solved in assembly, a robot on a grid Clip Loomclipboard programs you can read: strip, squeeze, wrap Weft-8 on hardwarethe same machine in C, three-way parity with the JS one weft8-kitrules small enough to sign off Weft-8 Classroomeight exercises that teach how a computer works
Weft-8 beside x86 and ARMyou are here

Every one of these runs the same engine — weft8.js from the Loom, byte for byte. Learn it once and you have learned all seven.