-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathdoc.go
More file actions
35 lines (35 loc) · 1.29 KB
/
Copy pathdoc.go
File metadata and controls
35 lines (35 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Package watgo provides the public high-level Go API for parsing,
// validating, decoding, and encoding WebAssembly modules.
//
// Runtime support lives in [github.com/eliben/watgo/wasmvm],
// which exposes a small interpreter for testing and experimentation with
// validated [wasmir.Module] values. It is not designed for high-performance
// execution.
//
// The package is centered on semantic IR represented by [wasmir.Module].
// Text-format WAT and binary WASM both normalize into that IR:
//
// - [ParseWAT] parses and lowers WAT into semantic IR.
// - [ParseAndValidateWAT] parses, lowers, and validates WAT.
// - [DecodeWASM] decodes binary WASM into semantic IR.
// - [ValidateModule] validates semantic IR.
// - [EncodeWASM] encodes semantic IR back to binary WASM.
// - [PrintWAT] renders semantic IR back to WAT.
// - [CompileWATToWASM] is the end-to-end convenience helper for WAT-to-WASM.
//
// A typical pipeline is:
//
// m, err := watgo.ParseWAT(src)
// if err != nil {
// // handle parse/lower diagnostics
// }
// if err := watgo.ValidateModule(m); err != nil {
// // handle validation diagnostics
// }
// wasm, err := watgo.EncodeWASM(m)
// if err != nil {
// // handle encoding diagnostics
// }
//
// See the package examples for complete runnable usage snippets.
package watgo