aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-07-31 22:29:24 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-25 14:36:46 +0200
commit0f26e1d204d3a3026ca3edfc4c6bd9638b2632e7 (patch)
treede196ca25cf8f685e14b219198162d68c61efcfd /doc
parentfa2a9e79e21063137f863887adc88fc74d3573e2 (diff)
Add nullable, add bytecode documentation
Diffstat (limited to 'doc')
-rw-r--r--doc/Documentation.md48
1 files changed, 41 insertions, 7 deletions
diff --git a/doc/Documentation.md b/doc/Documentation.md
index f7dde0a..01b6a6b 100644
--- a/doc/Documentation.md
+++ b/doc/Documentation.md
@@ -1,7 +1,7 @@
# Opcode
Variable length opcodes. Sizes range from 1 to 4 bytes.
## Instruction formats
-Instructions can be in 6 different formats:
+Instructions can be in 7 different formats:
1. 1 byte: Opcode(u8)
2. 2 bytes: Opcode(u8) + register(u8)
3. 3 bytes: Opcode(u8) + register(u8) + register(u8)
@@ -27,11 +27,45 @@ and may even lose performance because of it.
# Bytecode header
## Header layout
-|Size|Name |Description |
+|Type|Field |Description |
|----|-------------|----------------------------------------------------------------------------|
-|4 |Magic number |The magic number used to identify an amalgam bytecode file. |
-|1 |Major version|The major version of the bytecode. Updates in this is a breaking change. |
-|1 |Minor version|The minor version of the bytecode. Updates in this are backwards compatible.|
-|1 |Patch version|The patch version of the bytecode. Updates in this are only minor bug fixes.|
+|u32 |Magic number |The magic number used to identify an amalgam bytecode file. |
+|u8 |Major version|The major version of the bytecode. Updates in this is a breaking change. |
+|u8 |Minor version|The minor version of the bytecode. Updates in this are backwards compatible.|
+|u8 |Patch version|The patch version of the bytecode. Updates in this are only minor bug fixes.|
-The versions in the header only changes for every release, not every change. \ No newline at end of file
+The versions in the header only changes for every release, not every change.
+
+# Bytecode intermediates
+## Intermediates layout
+|Type |Field |Description |
+|------------|------------------|-------------------------------------------------------------------------------|
+|u32 |Intermediates size|The size of the intermediates section, in bytes. |
+|Intermediate|Intermediate data |Multiple intermediates, where the total size is defined by @Intermediates size.|
+
+## Intermediate
+|Type|Field|Description |
+|----|-----|----------------------------------------------------|
+|u8 |Type |The type of the number. 0=integer, 1=float. |
+|u64 |Value|The type of the value depends on the value of @Type.|
+
+# Bytecode strings
+## Strings layout
+|Type |Field |Description |
+|-------|-----------------|------------------------------------------------------------------|
+|u16 |Number of strings|The number of strings. |
+|u32 |Strings size |The size of the strings section, in bytes. |
+|String*|Strings data |Multiple strings, where the total size is defined by @Strings size|
+
+## String
+|Type|Field|Description |
+|----|----|----------------------------------------------------------------------------------------|
+|u16 |Size|The size of the string, in bytes. |
+|u8* |Data|The data of the string, where the size is defined by @Size. Strings are null-terminated.|
+
+# Bytecode instructions
+## Instructions layout
+|Type |Field |Description |
+|------------|-----------------|---------------------------------------------------------------------------|
+|u32 |Instructions size|The size of the instructions section, in bytes. |
+|Instruction*|Instructions data|The instructions data. Each instructions begins with an opcode, see #Opcode| \ No newline at end of file