-
Notifications
You must be signed in to change notification settings - Fork 5
Getting started hacking the compiler
- A unix-like system (Linux, MacOSX, etc.)
- gcc and GNU Make.
- git
Just clone the official Github repository to get a local copy of the sources:
$ git clone https://github.com/ocaml/ocaml.git
For significant chunks of work, forking the repository on GitHub will make it easier to share patches, merge changes, etc.
There are several people around who are familiar with git and happy to help, so don't be shy about asking for guidance if you're not sure what to do.
The INSTALL in the OCaml distribution contains full instructions. For the impatient, the following will build the compiler:
$ ./configure
$ make world.opt
See the HACKING.adoc file for more information on the source tree.
-
First, install Gabriel Scherer's opam-compiler-conf script
-
Do the following to compile and install your experimental compiler. Switch to new compiler environment accordingly
$ opam compiler-conf configure $ make -j world.opt $ opam compiler-conf install
Optionally, verify you are indeed using experimental compiler by checking
ocaml -version
. -
Now, we install Merlin. Use
opam info merlin
to make sure available version of Merlin is at least version 2.3. Otherwise, runopam update
$ opam install merlin
-
Try use Merlin to type compiler source code. If that does not work out, try restart your editor.
-
When you are happy with your compiler and want to try it out, do
$ make -j world.opt $ opam compiler-conf reinstall
The last command will also compile Merlin (and all packages) again using new compiler.
See the Things to work on page, which has a section dedicated to the language implementation.
Patches can be submitted as github pull requests.