What is Melange
Melange is a set of tools that come together to generate and interoperate with modern JavaScript:
The compiler libraries: These libraries are a fork of the OCaml compiler libraries with adaptations for generating lean JavaScript code, as opposed to bytecode or assembly.
The compiler (
melc
): This executable takes OCaml code as input and is responsible for generating JavaScript. It relies on the Melange compiler libraries.The runtime: This is a small code component essential for running JavaScript programs produced by the compiler.
The standard libraries: Melange includes a set of foundational elements such as data structures, functions, and bindings to JavaScript APIs, all aimed at helping developers accelerate app development.
The preprocessor (
melange.ppx
): This is a meta-programming tool designed to preprocess Melange programs, simplifying code generation for common use cases like generating bindings or code from types.The playground: This is a browser-based version of the compiler, enabling users to experiment with and share Melange code snippets and small programs.
In addition to these core components, there is an ongoing effort to integrate Melange into the broader OCaml Platform and other tools and libraries within the OCaml ecosystem:
A build system: Dune, a prominent OCaml build system, provides seamless support for Melange.
A package manager: Melange seamlessly integrates with opam, OCaml's default package manager.
A package repository: Melange libraries and tools are published in the main public package repository for opam.
Syntaxes: Melange empowers users to optionally write their applications using the Reason syntax, with full support for React applications through the Melange bindings library ReasonReact.
Editor integration: Melange is fully compatible with the OCaml editor tools, and also with code formatters like ocamlformat and refmt.