Add READMEs
This commit is contained in:
parent
cf4506e656
commit
b84dff4c94
7
README.md
Normal file
7
README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# 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 folder `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 folder `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 objective is to bootstrap OCaml.
|
||||
- An handwritten lexer for the bootstrapping of ocamllex, in the folder `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.
|
8
interpreter/README.md
Normal file
8
interpreter/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# OCaml interpreter
|
||||
|
||||
This folder contains an interpreter for OCaml, written in miniml. It aims to be as correct as possible while only using the untyped representation of the program.
|
||||
|
||||
It has three main modes:
|
||||
- `./interp ocamlc`, which will interpret the compiler sources to get a replacement for `ocamlc`,
|
||||
- `./interp ocamlopt`, which will interpret the compiler sources to get a replacement for `ocamlopt`,
|
||||
- `./interp files [list of files]`, which will interpret the list of files given as argument.
|
16
miniml/compiler/README.md
Normal file
16
miniml/compiler/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# miniml compiler
|
||||
|
||||
The file `compile.scm` is a single-file compiler for the miniml language, written in Scheme. It targets the OCaml bytecode for the version 4.07.0 of the OCaml compiler.
|
||||
|
||||
It is used as such:
|
||||
```bash
|
||||
$ guile compile.scm file.ml -o file.byte
|
||||
```
|
||||
The file `file.byte` will then contain executable OCaml bytecode, which can be run using `ocamlrun` from version 4.07.0 of the OCaml compiler (in this repository's `ocaml-src/` submodule).
|
||||
|
||||
It can only process a single file of input; in case you wish to use multiple files, you must first bundle them all into a single `.ml` file, putting the contents of file `x.ml` between `module X = struct`/`end` delimiters.
|
||||
|
||||
All OCaml external functions can be used with `external` declarations, but primitives work differently: they call a single bytecode instruction, with the instruction number specified in the external declaration; see `hello.ml` for examples.
|
||||
|
||||
`miniml` is completely untyped, and error reporting during compilation is very limited. However, since syntax and semantics are almost completely compatible with OCaml, in most cases you can just use OCaml to find the syntax or type error.
|
||||
|
Loading…
x
Reference in New Issue
Block a user