Bytecode
A woven script starts with the bytes "WF" and a version, then a constant pool (numbers as 64-bit floats, strings as UTF-8), then its functions. Function 0 is the script itself. Each op is one byte; operands follow little-endian.
| Ops | Operands |
|---|---|
| const | u16 constant |
| nil, true, false, pop, dup | — |
| load, store | u8 depth, u8 slot |
| builtin | u8 id |
| add, sub, mul, div, mod, idiv, pow, neg, not, concat | — |
| eq, ne, lt, le, gt, ge | — |
| jmp, jf, jfk, jtk, jnk | i16 offset |
| call | u8 argument count |
| ret | — |
| closure | u16 function |
| list, map | u16 count |
| index, setindex, index1, setindex1 | — |