Skip to content

ocaml-wasm/wasocaml

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • OCaml 83.4%
  • C 10.5%
  • Shell 2.6%
  • Makefile 0.9%
  • Assembly 0.9%
  • M4 0.5%
  • Other 1.2%