aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Wagner <mail@lukewagner.name>2015-05-05 08:16:57 -0500
committerLuke Wagner <mail@lukewagner.name>2015-05-05 08:16:57 -0500
commit29c5973ff6a33e863a302f7f03eb5cfd6f06e314 (patch)
tree43169df80629cbf1c335602a4dac545beaf59715
parent2a98b08e4c252a6b4729660975e435d101726330 (diff)
parent5bf929243cd8f2ce0388bccc4009ace8e01d18b2 (diff)
downloadnanowasm-design-29c5973ff6a33e863a302f7f03eb5cfd6f06e314.tar.gz
Merge pull request #22 from WebAssembly/text-format
Clarify the equivalence between the binary and text format
-rw-r--r--V1.md11
1 files changed, 8 insertions, 3 deletions
diff --git a/V1.md b/V1.md
index 2f9dc5e..c743ec1 100644
--- a/V1.md
+++ b/V1.md
@@ -14,7 +14,7 @@ precise descriptions of:
* At the top level, a module is ELF-like: a squence of sections which declare their type and byte-length.
* Sections with unknown types would be skipped without error.
* Standardized section types:
- * module import section (see [Module imports](V1.md#module-imports) below)
+ * module import section (see [Module imports](V1.md#module-imports) below)
* globals section (constants, signatures, variables)
* code section (see [Code section](V1.md#code-section) below)
* heap initialization section (see [Heap](V1.md#heap) below)
@@ -45,7 +45,10 @@ precise descriptions of:
* See the [AST Semantics](AstSemantics.md) for descriptions of individual AST nodes.
## Binary format
-* This is the format natively decoded by the browser.
+* The sole purpose of this format is efficiency: reducing download size and making decoding
+ faster, thus enabling even very large codebases to have quick startup times.
+ * Towards that goal, the binary format will be natively decoded by the browser.
+* The binary format has an equivalent and isomorphic [text format](V1.md#text-format).
* Do not try to compete with a generic compression algorithm by trying to suck out every last bit;
assume a generic compression algorithm is applied on top of the binary encoding.
* "Given that text is so compressible and it is well known that it is hard to beat gzipped source,
@@ -63,10 +66,12 @@ precise descriptions of:
## Text format
* The purpose of this format is to support:
- * View Source on a WebAssembly module.
+ * View Source on a WebAssembly module, thus fitting into the Web (where every source can
+ be viewed) in a natural way.
* Presentation in browser devtools when source maps aren't present (which is necessarily the case with v.1).
* Writing WebAssembly code directly for reasons including pedagogical, experimental, debugging, or
optimization.
+* The text format is equivalent and isomorphic to the [binary format](V1.md#binary-format).
* Given that the code representation is actually an AST, the syntax would contain nested
statements and expressions (instead of the linear list of instructions most assembly languages have).
* There is no requirement to use JS syntax; this format is not intended to be evaluated or translated