From 93e5a92f315662c7898b5a1226f592868e097e8a Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 11 May 2016 14:28:36 -0700 Subject: [PATCH 1/3] Clarify that wasm may be viewed as either an AST or a stack machine. --- AstSemantics.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/AstSemantics.md b/AstSemantics.md index 94b2f2cc..e1b9e951 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -1,14 +1,22 @@ # Abstract Syntax Tree Semantics -WebAssembly code is represented as an Abstract Syntax Tree (AST) where each node -represents an expression. Each function body consists of a list of expressions. -All expressions and operators are typed, with no implicit conversions or overloading rules. +WebAssembly code is represented in a form that can be interpreted either as an +Abstract Syntax Tree (AST) where each node represents an expression, or as a +typed stack machine, where each node represents an instruction. This document +describes WebAssembly's semantics from an AST-oriented perspective, however +WebAssembly can be naturally described from a stack machine perspective as well. + +Implementations need not build an actual AST or maintain an actual stack; they +need only behave [as if](https://en.wikipedia.org/wiki/As-if_rule) they did so. This document explains the high-level design of the AST: its types, constructs, and semantics. For full details consult [the formal Specification](https://github.com/WebAssembly/spec), for file-level encoding details consult [Binary Encoding](BinaryEncoding.md), and for the human-readable text representation consult [Text Format](TextFormat.md). +Each function body consists of a list of expressions. All expressions and +operators are typed, with no implicit conversions or overloading rules. + Verification of WebAssembly code requires only a single pass with constant-time type checking and well-formedness checking. From 40b428b849620dcd42b33194289494a7aada7240 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 12 May 2016 14:48:56 -0700 Subject: [PATCH 2/3] Reword the introductory paragraph. --- AstSemantics.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/AstSemantics.md b/AstSemantics.md index e1b9e951..c3656a3d 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -1,12 +1,9 @@ # Abstract Syntax Tree Semantics -WebAssembly code is represented in a form that can be interpreted either as an -Abstract Syntax Tree (AST) where each node represents an expression, or as a -typed stack machine, where each node represents an instruction. This document -describes WebAssembly's semantics from an AST-oriented perspective, however -WebAssembly can be naturally described from a stack machine perspective as well. - -Implementations need not build an actual AST or maintain an actual stack; they +This document describes WebAssembly semantics. The description here is written +in terms of an Abstract Syntax Tree (AST), however it is also possible to +understand WebAssembly semantics in terms of a typed stack machine. In practice, +implementations need not build an actual AST or maintain an actual stack; they need only behave [as if](https://en.wikipedia.org/wiki/As-if_rule) they did so. This document explains the high-level design of the AST: its types, constructs, and From aa524f9c3873ac5a5850201d56ae1a5eb802265a Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 12 May 2016 18:39:06 -0700 Subject: [PATCH 3/3] Add parens, remove "typed". --- AstSemantics.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AstSemantics.md b/AstSemantics.md index c3656a3d..a1ada2c2 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -2,9 +2,9 @@ This document describes WebAssembly semantics. The description here is written in terms of an Abstract Syntax Tree (AST), however it is also possible to -understand WebAssembly semantics in terms of a typed stack machine. In practice, +understand WebAssembly semantics in terms of a stack machine. (In practice, implementations need not build an actual AST or maintain an actual stack; they -need only behave [as if](https://en.wikipedia.org/wiki/As-if_rule) they did so. +need only behave [as if](https://en.wikipedia.org/wiki/As-if_rule) they did so.) This document explains the high-level design of the AST: its types, constructs, and semantics. For full details consult [the formal Specification](https://github.com/WebAssembly/spec),