Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ekdohibs/camlboot
Experiment on how to bootstrap the OCaml compiler
https://github.com/ekdohibs/camlboot
ocaml
Last synced: 3 months ago
JSON representation
Experiment on how to bootstrap the OCaml compiler
- Host: GitHub
- URL: https://github.com/ekdohibs/camlboot
- Owner: Ekdohibs
- License: mit
- Created: 2018-09-23T19:27:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-04-16T10:07:39.000Z (almost 3 years ago)
- Last Synced: 2024-10-10T22:29:01.608Z (3 months ago)
- Topics: ocaml
- Language: OCaml
- Size: 13.2 MB
- Stars: 95
- Watchers: 8
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# camlboot: An OCaml bootstrap experiment
camlboot is an experiment on the boostraping of the [OCaml](https://ocaml.org/) 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](https://www.gnu.org/software/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.