Go to file
Gabriel Scherer 2692b14a4e
Merge pull request #58 from curiousleo/fix-double-map-import
Don't import "map" twice in compile.scm
2022-04-16 12:07:39 +02:00
interpreter interpreter: convert the trace counter to Int64 for 32bit portability 2021-09-24 18:23:43 +02:00
lex Make hand-made lexer work with miniml 2021-02-12 15:46:08 +01:00
miniml Stop importing "map" twice 2022-04-16 14:54:13 +08:00
ocaml-src@31e7a6dd1a Remove locations from lex/ as well 2021-02-22 10:13:26 +01:00
patches update the ocaml-src submodule to track the maintenance 4.07 branch 2020-12-10 21:28:48 +01:00
.gitignore Ignore generated interpreter files 2020-12-05 15:33:44 +01:00
.gitmodules Remove paths from files produced by ocamlc 2021-02-22 10:02:03 +01:00
.merlin Able to compile some files, but still crashing because of labels 2018-09-23 21:28:44 +02:00
.ocamlformat format: limit to 80 columns 2020-11-24 14:37:00 +01:00
LICENSE Initial commit 2018-09-23 21:27:51 +02:00
Makefile Makefile: build for any architecture 2021-09-22 12:57:29 -04:00
Makefile.ocamlc Parallel compilation 2021-02-19 12:07:54 +01:00
Makefile.stdlib Fix last steps 2021-02-20 19:36:16 +01:00
README.md Compilation instructions 2021-02-24 08:53:34 +01:00
compile_ocamlc.sh Use interpopt.opt for bootstrap 2021-02-17 15:21:13 +01:00
compile_stdlib.sh Use interpopt.opt for bootstrap 2021-02-17 15:21:13 +01:00
timed.sh Add script for computing timings 2021-02-17 15:15:16 +01:00

README.md

camlboot: An OCaml bootstrap experiment

camlboot is an experiment on the boostraping of the OCaml compiler. It is composed of:

  • An interpreter of OCaml, in the directory interpreter/, which is able to interpret the OCaml compiler. This interpreter is written in a subset of OCaml called miniml, for which a compiler is available as part of the experiment.
  • A compiler for miniml, in the directory miniml/compiler/. This compiler compiles miniml to OCaml bytecode, which is then executed by the OCaml runtime. It is written in scheme (more specifically, guile), since the goal is to bootstrap OCaml. Note that guile is itself bootstrapped directly from gcc, and building OCaml needs a C compiler as well, so we effectively bootstrap OCaml from gcc.
  • A handwritten lexer for the bootstrapping of ocamllex, in the directory lex/. This lexer is able to perform the lexing of ocamllex's own lexer.mll, the first step towards the bootstrap of ocamllex, and then OCaml.

Compilation:

After cloning, you first need to clone the ocaml/ submodule, with git submodule init && git submodule update --recursive. You will also need a C compiler, and guile.

Then you can perform make -j$(nproc) _boot/ocamlc && make -j$(nproc) fullboot, which will compile a bootstrap compiler, and use it to fully bootstrap OCaml from sources. The resulting bytecode should be bit-for-bit compatible with the one you can get by compiling the code in the ocaml-src/ submodule with its own bundled bootstrap compiler. Expect this to take some time: on an 8-core machine, it took about 16 hours of CPU time, and 4 hours of wall-clock time.