/wacil

A WebAssembly to CIL compiler

Primary LanguageF#Apache License 2.0Apache-2.0

wacil

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.

"module.wasm" |> dotnet exec

Yet another experimental compiler that translates WebAssembly files (.wasm) to .NET assemblies/modules (.dll/.netmodule) containing Common Intermediate Language bytecode.

Powered by AsmResolver, a high level library for generating .NET metadata.

Currently, work is focused on supporting most of the features from version 1.0 of the WebAssembly specification, as well as some features in the version 2.0 draft.

The following merged proposals are currently supported:

The following proposals (that at the time of writing have not yet been standardized) are currently supported:

How does it work?

Like other "compilers" from WebAssembly to CIL, WebAssembly instructions are translated to CIL instructions, which is more efficient that simply writing a WASM interpreter in C# or F#. Unlike other compilers however, all modules translated by Wacil include a reference to a runtime library Wacil.Runtime.dll. Having a separate runtime library rather than simply embedding code in the generated assembly has its own drawbacks, but has the advantage of avoiding code duplication.