Skip to content

eliben/wasm-wat-samples

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
add
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

WebAssembly WAT samples

Some sample WebAssembly Text programs.

WebAssembly defines a portable binary-code format and a corresponding text format for executable programs as well as software interfaces for facilitating interactions between such programs and their host environment.

The text format (WAT) is, essentially, an assembly language. While most people will not write WAT directly (just as most programmers don't write assembly code directly), familiarity this format is important if you seek a deep understanding of WASM mechanisms and related toolchains.

How to run these samples

Unless otherwise stated, each sample consists of a single .wat file and an accompanying test.js file. When the setup is more complicated, the directory's own README will have additional information.

First, start by compiling the WAT file to WASM with wabt or some other WASM toolchain:

$ wat2wasm somefile.wat

This creates a somefile.wasm binary, which test.js expects to find in its own directory. To load and test the WASM, you'll need a recent Node.js installed, and run:

$ node test.js

This will typically emit some output; if the loading failed or the loaded WASM behaves unexpectedly, the test.js script will report an error.

WASI documentation

Useful sources of documentation about WASI host calls:

About

Samples of WebAssembly Text programs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published