watr 3.0.0 → 3.1.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 +1 -1
- package/readme.md +16 -32
- package/src/compile.js +578 -457
- package/src/const.js +25 -33
- package/src/encode.js +47 -12
- package/src/parse.js +15 -7
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# watr [](https://github.com/audio-lab/watr/actions/workflows/test.js.yml) [](https://bundlephobia.com/package/watr) [](https://npmjs.org/watr)
|
|
2
2
|
|
|
3
|
-
Light & fast WASM compiler. An alternative to [wabt/wat2wasm](https://github.com/AssemblyScript/wabt.js).<br/>
|
|
4
|
-
Useful for
|
|
3
|
+
Light & fast WASM compiler. An alternative to [wabt/wat2wasm](https://github.com/AssemblyScript/wabt.js) or [spec/wast]().<br/>
|
|
4
|
+
Useful for high-level languages or dynamic (in-browser) compilation.<br>
|
|
5
|
+
Supports full [spec text syntax](https://webassembly.github.io/spec/core/text/index.html) and [official testsuite](https://github.com/WebAssembly/testsuite).
|
|
5
6
|
|
|
6
7
|
## Usage
|
|
7
8
|
|
|
@@ -73,35 +74,34 @@ print(src, {
|
|
|
73
74
|
## Status
|
|
74
75
|
|
|
75
76
|
* [x] core
|
|
76
|
-
* [x] [
|
|
77
|
+
* [x] [mutable globals](https://github.com/WebAssembly/mutable-global)
|
|
77
78
|
* [x] [extended const](https://github.com/WebAssembly/extended-const/blob/main/proposals/extended-const/Overview.md)
|
|
78
|
-
* [
|
|
79
|
-
* [
|
|
79
|
+
* [x] [nontrapping float to int](https://github.com/WebAssembly/nontrapping-float-to-int-conversions)
|
|
80
|
+
* [x] [sign extension](https://github.com/WebAssembly/sign-extension-ops)
|
|
80
81
|
* [x] [multi-value](https://github.com/WebAssembly/spec/blob/master/proposals/multi-value/Overview.md)
|
|
81
82
|
* [x] [bulk memory ops](https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md)
|
|
82
|
-
* [ ] [memory64](https://github.com/WebAssembly/memory64)
|
|
83
83
|
* [x] [multiple memories](https://github.com/WebAssembly/multi-memory/blob/master/proposals/multi-memory/Overview.md)
|
|
84
84
|
* [x] [simd](https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md)
|
|
85
|
-
* [
|
|
85
|
+
* [x] [relaxed simd](https://github.com/WebAssembly/relaxed-simd)
|
|
86
|
+
* [x] [fixed-width simd](https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md)
|
|
87
|
+
* [x] [tail_call](https://github.com/WebAssembly/tail-call)
|
|
86
88
|
* [x] [ref types](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md)
|
|
87
89
|
* [x] [func refs](https://github.com/WebAssembly/function-references/blob/main/proposals/function-references/Overview.md)
|
|
88
90
|
* [ ] [gc](https://github.com/WebAssembly/gc)
|
|
89
91
|
* [ ] [exceptions](https://github.com/WebAssembly/exception-handling)
|
|
90
|
-
* [ ] [
|
|
91
|
-
* [ ] [tail_call](https://github.com/WebAssembly/tail-call)
|
|
92
|
+
* [ ] [memory64](https://github.com/WebAssembly/memory64)
|
|
92
93
|
* [ ] [annotations](https://github.com/WebAssembly/annotations)
|
|
93
94
|
* [ ] [code_metadata](https://github.com/WebAssembly/tool-conventions/blob/main/CodeMetadata.md)
|
|
95
|
+
* [ ] [js strings](https://github.com/WebAssembly/js-string-builtins/blob/main/proposals/js-string-builtins/Overview.md)
|
|
94
96
|
|
|
95
97
|
## Alternatives
|
|
96
98
|
|
|
97
|
-
| Size (gzipped) | Performance
|
|
99
|
+
| Size (gzipped) | Performance
|
|
98
100
|
---|---|---
|
|
99
|
-
watr |
|
|
100
|
-
[
|
|
101
|
-
[
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
<!-- Watr has better syntax support than wabt & produces more compact output due to types squash. -->
|
|
101
|
+
watr | 6.2 kb | 11.6 op/s
|
|
102
|
+
[spec/wast.js](https://github.com/WebAssembly/spec/tree/main/interpreter#javascript-library) | 216 kb | 7.1 op/s
|
|
103
|
+
[wabt](https://github.com/WebAssembly/wabt) | 282 kb | 2.3 op/s
|
|
104
|
+
[wat-compiler](https://github.com/stagas/wat-compiler) | 7.7 kb | 1.34 op/s
|
|
105
105
|
|
|
106
106
|
<!--
|
|
107
107
|
## Projects using watr
|
|
@@ -118,20 +118,4 @@ watr | 5 kb | 6000
|
|
|
118
118
|
* [WASM binary encoding](https://github.com/WebAssembly/design/blob/main/BinaryEncoding.md)
|
|
119
119
|
-->
|
|
120
120
|
|
|
121
|
-
<!--
|
|
122
|
-
## Refs
|
|
123
|
-
|
|
124
|
-
* [mdn wasm text format](https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format)
|
|
125
|
-
* [wasm reference manual](https://github.com/sunfishcode/wasm-reference-manual/blob/master/WebAssembly.md)
|
|
126
|
-
* [wabt source search](https://github.com/WebAssembly/wabt/search?p=5&q=then)
|
|
127
|
-
* [wat control flow](https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/Control_flow)
|
|
128
|
-
* [ontouchstart wasm book](https://ontouchstart.pages.dev/chapter_wasm_binary)
|
|
129
|
-
* [hackernoon](https://web.archive.org/web/20210215171830/https://hackernoon.com/webassembly-binary-format-explained-part-2-hj1t33yp?source=rss)
|
|
130
|
-
* [webassemblyjs](https://github.com/xtuc/webassemblyjs)
|
|
131
|
-
* [chasm](https://github.com/ColinEberhardt/chasm/blob/master/src/encoding.ts)
|
|
132
|
-
* [WebBS](https://github.com/j-s-n/WebBS)
|
|
133
|
-
* [leb128a](https://github.com/minhducsun2002/leb128/blob/master/src/index.ts)
|
|
134
|
-
* [leb128b](https://github.com/shmishtopher/wasm-LEB128/tree/master/esm)
|
|
135
|
-
-->
|
|
136
|
-
|
|
137
121
|
<p align=center><a href="https://github.com/krsnzd/license/">🕉</a></p>
|