aboutsummaryrefslogtreecommitdiff
path: root/BinaryEncoding.md
diff options
context:
space:
mode:
authorMichael Holman <michael.holman@microsoft.com>2015-06-29 15:40:54 -0700
committerMichael Holman <michael.holman@microsoft.com>2015-06-29 15:40:54 -0700
commitad4a73eddd074cec18a94bd6bc843f19504217e0 (patch)
treef7b4f11d93dacd62176e3cb4269365b746669669 /BinaryEncoding.md
parentf638520afb6c669442caa7d788bbcdbef300edf8 (diff)
downloadnanowasm-design-ad4a73eddd074cec18a94bd6bc843f19504217e0.tar.gz
cleanup and clarifications
Diffstat (limited to 'BinaryEncoding.md')
-rw-r--r--BinaryEncoding.md52
1 files changed, 28 insertions, 24 deletions
diff --git a/BinaryEncoding.md b/BinaryEncoding.md
index 61fb019..1f4f3ed 100644
--- a/BinaryEncoding.md
+++ b/BinaryEncoding.md
@@ -66,35 +66,39 @@ Yes:
## Global structure
* A module contains (in this order):
- * A header
- * A table (sorted by offset) containing, for each section:
- * Section type
- * Offset within the module
- * A sequence of sections
+ - A header, containing:
+ + The [magic number](https://en.wikipedia.org/wiki/Magic_number_%28programming%29)
+ + Other data TBD (possibly entrypoint, memory bitness, source language, etc.)
+ - A table (sorted by offset) containing, for each section:
+ + A string literal section type name
+ + 32-bit offset within the module
+ - A sequence of sections
* A section contains:
- * A header followed by
- * The section contents (specific to the section type)
-* A definitions section contains (in this order):
- * The generic section header
- * A table (sorted by offset) containing, for each type which has opcodes:
- * A standardized string literal [type name](AstSemantics.md#local-and-memory-types).
+ - A header followed by
+ - The section contents (specific to the section type)
+* A `definitions` section contains (in this order):
+ - The generic section header
+ - A table (sorted by offset) containing, for each type which has opcodes:
+ + A standardized string literal [type name](AstSemantics.md#local-and-memory-types).
The index of a type name in this table is referred to as a type ID
- * Offset of its opcode table within the section
- * A sequence of opcode tables
- * An opcode table contains:
- * A sequence of standardized string literal [opcode names](AstSemantics.md),
+ + 32-bit offset of its opcode table within the section
+ - A sequence of opcode tables
+ - An opcode table contains:
+ + A sequence of standardized string literal [opcode names](AstSemantics.md),
where order determines opcode index
-* A code section contains (in this order):
- * The generic section header
- * A table (sorted by offset) containing, for each function:
- * Signature
- * Offset within the section
- * A sequence of functions
- * A function contains:
- * A table containing, for each type ID that has [locals](AstSemantics.md#addressing-local-variables):
+* A `code` section contains (in this order):
+ - The generic section header
+ - A table (sorted by offset) containing, for each function:
+ + Signature
+ + 32-bit offset within the section
+ - A sequence of functions
+ - A function contains:
+ + A table containing, for each type ID that has [locals](AstSemantics.md#addressing-local-variables):
* Type ID
* Count of locals
- * The serialized AST
+ + The serialized AST
+
+All strings are encoded as null-terminated UTF8.
## Serialized AST