Generating Javascript bindings from OCaml interfaces.

Alain Frisch

LexiFi is currently experimenting with the js_of_ocaml compiler in order to create some browser-side applications in OCaml.

In this context, we have started a new project called gen_js_api which aims at simplifying the creation of bindings to Javascript libraries. The approach is quite different from js_of_ocaml’s native FFI (which relies on language extensions). In gen_js_api, authors of bindings define the expected OCaml interface, annotated with light attributes to define the actual mapping to Javascript; and client of generated bindings work with native OCaml types, without requiring any language extension, nor any knowledge of how js_of_ocaml represents OCaml values in Javascript.

gen_js_api has reached a state where actual bindings can be written, and it is reasonably well documented. It is now a good time to look at the project if you’re interested in this topic. Of course, feel free to comment on the project or contribute to it.