Creating components

Many popular programming languages can be compiled to WebAssembly, but the level of support varies across languages. This document details languages with compilers and runtimes that support WebAssembly with WASI as a target platform.

This is a living document, so if you are aware of advancements in a toolchain, please do not hesitate to contribute documentation. You can find more information about the development of support for specific languages in the Guest Languages Special Interest Group Proposal document.

One of the benefits of components is their portability across host runtimes. The runtime only needs to know what world the component is targeting in order to import or execute the component. This language guide hopes to demonstrate that with a prevailing adder world defined in examples/tutorial/wit/adder/world.wit. Furthermore, an example host that understands the example world has been provided in examples/example-host for running components. Each toolchain section walks through creating a component of this world, which can be run either in the example host or from an application of that toolchain. This aims to provide a full story for using components within and among toolchains.

Each section covers how to build and run components for a given toolchain. The last section, on WebAssembly Text Format (WAT), details how to write WebAssembly components by hand, without using a higher-level language front-end.