This commit is contained in:
2026-04-28 11:42:12 -05:00
parent 84f725634e
commit c17788eeab
6 changed files with 62 additions and 43 deletions

View File

@@ -74,39 +74,6 @@ Error handling: (0xa0~0xaf)
???
Bytecode format
---------------
The bytecode file is composed of the following sections:
* 16-byte header
[0:3]: Magic
[4]: VM format
* Index: pointers to each one of the sections, up to 8
Each pointer: 4 bytes
Each count: 4 bytes
* [0x0] Constants: all constants (such as strings) used in the code
* Table of 4-byte constant indexes with pointer to constant
* Raw constant data
* [0x1] Functions: Pointer to functions within the code
[0:3]: function pointer
[4:5]: number of parameters
[6:7]: number of local variables
* [0x2] Code: executable code
[1-byte]: operation
[variable]: operand (see value encoding below)
* [0x3] Debugging info
???
The max file size is 2 Gb.
## Values can be encoded in the following ways:
* The type is defined by the operator.
* Encoding varies according to the type:
int: use protobuf format
float: 4-bit floating point
string: int-defined length, followed by the string proper - no null terminator
* Constant indexes and function ids are encoded as ints
Internal handling of values