BC0 File Parser
A bc0
file is divided into several sections:
Magic Number Starting with
C0 C0 FF EE
, the magic number tells us that this file is generated by aCC0
compiler. Some other "meta-data" like version number etc. are also included in this section.Integer Pool Inside the
bc0
instructions, we can push small values ranging from0x00
to0xFF
directly into the operand stack usingBIPUSH
instruction. However, to use larger integer constants (literals that written in the code like0xDEADBEEF
), we need to store them separately in a Int Pool.String Pool String literals are stored in a specific memory section and will be loaded when the VM initializes. During the runtime, these strings will be loaded into the operand stack according to the instructions. This specific section is called the String Pool.
Functions The name of function and the bytecode instructions.
Native Pool The native functions that will be needed in this program will be logged here.
The parser will convert the bc0
raw string into a data structure like this:
Last updated