I spent some time studying various ways the OCaml compiler can produce web assembly and interpret or depend on other web assembly libraries. The landscape is quite confusing. Does anyone have experience with OCaml and web assembly? Is there a reliable project to bet on and start developing with? What about interop with other libraries that compile to wasm and you want to reference in OCaml? Here’s a list of the projects I have discovered which seem relevant. Would appreciate insights on whether they are being maintained, or if anybody has noteworthy experience with them:
- ocamlrun-wasm: https://github.com/sebmarkbage/ocamlrun-wasm
This is a build script for building the OCaml bytecode interpreter for WebAssembly using emscripten.
An OCaml library to read and write Web Assembly (wasm) files and manipulate their AST.
- cmm_of_wasm: http://simonjf.com/2018/08/27/cmm-of-wasm.html
From WebAssembly to Native Code via the OCaml Backend.
A fork of the ocaml compiler with a web assembly compile target.
Grain is a language built for the modern web by leveraging the brilliant work done by the WebAssembly project.
While grain is not actually OCaml it seems to be a fork of the OCaml codebase and thus worthy of mention.