Skip to content

Function encoding

Functions are encoded as the pair of a natural number identifier (specifying a particular virtual machine) and bytecode (to be interpreted by the virtual machine):

type Function := mkFunction {
    vmIdentifier : Natural;
    vmBytecode : []byte;
};
Identifier Virtual machine
0x00 - (reserved for the future)
0x01 - (reserved for the future)
0x02 Nockma
0x03 Cairo
0x04 RISC0

We then define the canonical function encoding functions as a switch-case over these particular virtual machines.