GithubHelp home page GithubHelp logo

ocaml-wasm / gen_js_api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lexifi/gen_js_api

2.0 1.0 0.0 703 KB

Easy OCaml bindings for Javascript libraries

License: MIT License

JavaScript 0.48% C 0.13% OCaml 99.04% Makefile 0.36%

gen_js_api's Introduction

gen_js_api: easy OCaml bindings for JavaScript libraries

Build Status

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.

  • ReScript: Another compiler from OCaml to JavaScript, featuring the genType ppx for generating TS / Flow types and runtime converters.

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: [email protected]

Contributors:

  • Alain Frisch
  • Sebastien Briais

gen_js_api's People

Contributors

alainfrisch avatar sbriais avatar mlasson avatar hhugo avatar cannorin avatar nojb avatar jchavarri avatar rgrinberg avatar smorimoto avatar bikallem avatar armish avatar clembu avatar damiendoligez avatar joelburget avatar vouillon avatar o-marshmallow avatar ryyppy avatar tmcgilchrist avatar

Stargazers

ᴍᴜǫɪᴜ ʜᴀɴ (韩暮秋) avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.