Skip to content
Easy OCaml bindings for Javascript libraries
OCaml Other
  1. OCaml 98.3%
  2. Other 1.7%
Branch: master
Clone or download
nojb Merge pull request #94 from facelesspanda/typo
[typo] correct wrong 'apply_arr' to 'apply'
Latest commit 7bd36e7 Sep 2, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples examples dont depend on js_of_ocaml Aug 7, 2019
lib
ppx-driver small tuning Aug 1, 2019
ppx-lib move files around Aug 1, 2019
ppx-standalone fix install section Aug 1, 2019
.gitignore cleanup gitignore Aug 1, 2019
.ocp-indent Add ocp-indent config. Mar 30, 2015
CHANGES.md
CLASSES.md Update CLASSES.md Jun 9, 2016
IMPLGEN.md Doc. Apr 24, 2015
INSTALL_AND_USE.md more doc Aug 1, 2019
LICENSE Doc. Apr 22, 2015
LOW_LEVEL_BINDING.md Rename iterate_properties into iter_properties. May 28, 2015
Makefile fix makefile Aug 1, 2019
NAMING.md Typo Sep 8, 2016
PPX.md Doc. Apr 24, 2015
README.md Fix for OCaml 4.05.0 and prepare for next release. Jul 13, 2017
TODO.md TODO. Jun 1, 2015
TYPES.md Add default case for sums and unions. Jun 22, 2015
VALUES.md Use a greek letter for meta-variables. Jul 17, 2017
dune fix warnings Aug 1, 2019
dune-project add project name Aug 2, 2019
gen_js_api.opam need at least ocaml 4.08 Aug 8, 2019

README.md

gen_js_api: easy OCaml bindings for Javascript libraries

Overview

gen_js_api aims at simplifying the creation of OCaml bindings for Javascript libraries. It must currently be used with the js_of_ocaml compiler, although other ways to run OCaml code "against" Javascript might be supported later with the same binding definitions (for instance, Bucklescript, or direct embedding of a JS engine in a native OCaml application).

gen_js_api is based on the following ideas:

  • Authors of bindings write OCaml signatures for Javascript libraries and the tool generates the actual binding code with a combination of implicit conventions and explicit annotations.

  • The generated binding code takes care of translating values between OCaml and Javascript and of dealing with Javascript calling conventions.

  • All syntactic processing is done by authors of bindings: the client code is normal OCaml code and does not depend on custom syntax nor on JS-specific types.

gen_js_api can be used in two complementary ways:

Examples

The repository contains some examples of OCaml bindings to Javascript libraries created with gen_js_api:

Documentation

Related projects

  • js_of_ocaml: The compiler and runtime system on which gen_js_api relies. (Note: gen_js_api doesn't depend on js_of_ocaml's OCaml library, nor on its language extension.)

  • goji: A DSL to describe OCaml bindings for JavaScript libraries.

  • DefinitelyMaybeTyped: A project to parse DefinitelyTyped interfaces and produce OCaml interfaces.

  • Bucklescript: Another compiler from OCaml to Javascript.

About

gen_js_api has been created by LexiFi for porting a web application from Javascript to OCaml. The tool has been used in production since 2015.

This gen_js_api package is licensed by LexiFi under the terms of the MIT license.

See see Changelog

Contact: alain.frisch@lexifi.com

Contributors:

  • Alain Frisch
  • Sebastien Briais
You can’t perform that action at this time.