Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Getting started hacking the compiler

Gabriel Scherer edited this page Jun 8, 2017 · 2 revisions

Prerequisites

  • A unix-like system (Linux, MacOSX, etc.)
  • gcc and GNU Make.
  • git

Where to find the OCaml sources

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.

Quickstart

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.

Use Merlin when hacking compiler

  1. First, install Gabriel Scherer's opam-compiler-conf script

  2. 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.

  3. Now, we install Merlin. Use opam info merlin to make sure available version of Merlin is at least version 2.3. Otherwise, run opam update

      $  opam install merlin
    
  4. Try use Merlin to type compiler source code. If that does not work out, try restart your editor.

  5. 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.

What to work on

The Things to work on page has a list of suggested projects. The official OCaml bug-tracker lists many more reported issues and feature requests. Tasks tagged junior_job may be particularly suitable for the inexperienced, but the tagging is very far from exhaustive, so feel free to look around. A couple more things worth knowing:

  • the assigned state doesn't necessarily mean that you should not work on the issue, since many bugs are auto-assigned by area of responsibility, and patches may still be welcome
  • issues in the resolved/suspended state are not considered closed; the core developer team isn't intending to work on such issues further but, again, patches may still be welcome

If you choose to work on something that's not currently listed under Things to work on, it'd be helpful if you could add it to that page.

Collaboration is strongly encouraged! Please indicate on the Things to work on page if you start work on an issue, if you would be willing to act as a mentor, etc.

Submitting patches upstream

Patches can be submitted as github pull requests.

Clone this wiki locally