watr 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -4
- package/readme.md +16 -10
- package/watr.js +358 -211
- package/watr.min.js +1 -1
- package/.gitattributes +0 -2
- package/example/amp.wasm +0 -0
- package/example/amp.wat +0 -81
- package/example/array.wat +0 -26
- package/example/global.wasm +0 -0
- package/example/global.wat +0 -28
- package/example/loops.wasm +0 -0
- package/example/loops.wat +0 -34
- package/example/memory.wasm +0 -0
- package/example/memory.wat +0 -34
- package/example/multivar.wasm +0 -0
- package/example/multivar.wat +0 -13
- package/example/stack.wasm +0 -0
- package/example/stack.wat +0 -38
- package/example/table.wasm +0 -0
- package/example/table.wat +0 -24
- package/example/types.wasm +0 -0
- package/example/types.wat +0 -21
- package/lib/wabt.js +0 -36
- package/lib/wat-compiler.js +0 -1
- package/plan.md +0 -21
- package/repl.html +0 -44
- package/src/compile.js +0 -456
- package/src/parse.js +0 -31
- package/src/watr.js +0 -8
- package/test/compile.js +0 -1090
- package/test/examples.js +0 -155
- package/test/index.html +0 -14
- package/test/index.js +0 -2
- package/test/parse.js +0 -179
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "watr",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Ligth & fast WAT compiler",
|
|
5
5
|
"main": "watr.js",
|
|
6
6
|
"type": "module",
|
|
@@ -11,8 +11,12 @@
|
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/
|
|
14
|
+
"url": "git+https://github.com/audio-lab/watr.git"
|
|
15
15
|
},
|
|
16
|
+
"files": [
|
|
17
|
+
"watr.js",
|
|
18
|
+
"watr.min.js"
|
|
19
|
+
],
|
|
16
20
|
"keywords": [
|
|
17
21
|
"wat",
|
|
18
22
|
"compiler",
|
|
@@ -21,9 +25,9 @@
|
|
|
21
25
|
"author": "Dmitry Iv",
|
|
22
26
|
"license": "ISC",
|
|
23
27
|
"bugs": {
|
|
24
|
-
"url": "https://github.com/
|
|
28
|
+
"url": "https://github.com/audio-lab/watr/issues"
|
|
25
29
|
},
|
|
26
|
-
"homepage": "https://github.com/
|
|
30
|
+
"homepage": "https://github.com/audio-lab/watr#readme",
|
|
27
31
|
"devDependencies": {
|
|
28
32
|
"rollup": "^2.70.1",
|
|
29
33
|
"terser": "^5.12.1",
|
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# watr
|
|
1
|
+
# watr [](https://github.com/audio-lab/watr/actions/workflows/test.js.yml)
|
|
2
2
|
|
|
3
3
|
> Light & fast WAT compiler.
|
|
4
4
|
|
|
@@ -17,9 +17,9 @@ Performance (op/s) | 45000 | 2500 | 3100
|
|
|
17
17
|
|
|
18
18
|
| Size (gzipped) | Performance (op/s)
|
|
19
19
|
---|---|---
|
|
20
|
-
watr |
|
|
21
|
-
wat-compiler | 6 kb |
|
|
22
|
-
wabt | 300 kb |
|
|
20
|
+
watr | 3.8 kb | 1900
|
|
21
|
+
wat-compiler | 6 kb | 135
|
|
22
|
+
wabt | 300 kb | 250
|
|
23
23
|
|
|
24
24
|
## Usage
|
|
25
25
|
|
|
@@ -62,8 +62,9 @@ double(108) // 216
|
|
|
62
62
|
|
|
63
63
|
## Limitations
|
|
64
64
|
|
|
65
|
-
Ambiguous syntax is
|
|
66
|
-
Each instruction
|
|
65
|
+
Ambiguous syntax is prohibited in favor of explicit lispy structure.<br>
|
|
66
|
+
Each instruction must have prefix signature with parenthesized immediates and arguments.<br>
|
|
67
|
+
It may be supported, but discouraged.
|
|
67
68
|
|
|
68
69
|
```wast
|
|
69
70
|
(func (result i32)
|
|
@@ -95,11 +96,16 @@ end
|
|
|
95
96
|
)
|
|
96
97
|
```
|
|
97
98
|
|
|
98
|
-
|
|
99
|
+
```wast
|
|
100
|
+
(f32.const 0x1.fffffep+127) ;; ✘ floating HEX (not supported)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```wast
|
|
104
|
+
(global.set $pc (;(i32.const <new-pc>);)) ✘ default arguments must be explicit
|
|
105
|
+
```
|
|
99
106
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
* Numeric placeholders `122_000.11_3_54E0_2_3` are not supported.
|
|
107
|
+
It may also miss some edge cases and nice error messages.
|
|
108
|
+
For good REPL experience better use wabt.
|
|
103
109
|
|
|
104
110
|
<!--
|
|
105
111
|
Main goal is to get very fluent with wasm text.
|