OCamlPro / wasocaml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wasocaml

Wasocaml is an OCaml compiler to Wasm.

It uses the Flambda IR of the compiler as a source language and targets Wasm-GC.

Quickstart

Install

Binaryen

You need the wasm-merge binary in your path. You can get it from the main branch of Binaryen.

$ git clone https://github.com/WebAssembly/binaryen.git
$ cd binaryen
$ git submodule init
$ git submodule update
$ cmake . && make
$ sudo make install

Wasocaml

You can now build and install Wasocaml. You can either build the compiler locally or install a switch with the Wasocaml compiler.

Locally
$ ./configure
$ make
$ sudo make install
Opam switch
$ opam switch create wasocaml --repos default,wasocaml=git+https://github.com/ocamlpro/wasocaml-opam.git ocaml-variants.4.14.1+wasocaml

Usage

Running the compiler will produce two files: a.out.wasm (the Wasm binary) and a.out.wast (the Wast text format).

$ /usr/local/bin/ocamlopt file.ml
$ ls
a.out a.out.wasm a.out.wast

For a complete example using the compiler installed as an opam switch, see wasocaml-demo.

Publications & talks

Publications

Talks

About

License:Other


Languages

Language:OCaml 83.5%Language:C 10.5%Language:Shell 2.6%Language:Makefile 0.9%Language:Assembly 0.9%Language:M4 0.5%Language:WebAssembly 0.3%Language:TeX 0.3%Language:SCSS 0.2%Language:Standard ML 0.2%Language:JavaScript 0.1%Language:Awk 0.1%Language:Batchfile 0.0%Language:HTML 0.0%Language:CSS 0.0%Language:Perl 0.0%Language:Forth 0.0%Language:C# 0.0%