MinCaml to ARM compiler.
Feel free to read the wiki for more documentation.
So far we are handling a subset of ML such that :
- Everything up to closures is working
- Some cases for closures are not working (for example closures in function) are supported. We are using the spill everything register allocation algorithm.
We also have a wide range of tests regarding this subset.
Finally we have documentation available, both in docs
and on the wiki.
Organization of the repository:
Folder | Description |
---|---|
ARM/ | arm source example and compilation with libmincaml |
asml/ | asml examples |
compiler/ | compiler source files |
doc/ | all the documentation, start with index.html |
mincaml/ | MinCaml examples |
ocaml/ | MinCaml parser in OCaml |
scripts/ | test scripts and symbolic links to binaries |
tests/ | ASML and MinCaml tests |
tools/ | asml intepreter (linux binary) |
Running command make
in the compiler/ folder will create three binaries:
mincamlc
is the compiler binary, compiling a MinCaml file into a ARM assembly file.armgen
is the backend binary, converting an ASML file into a ARM assembly file.asmlparse
is the parser, generating and printing an ast from an ASML file.
You can add the compiler/ dir to your PATH.
A basic usage of the compiler is
$ mincamlc mincaml_program.ml -o program.s
Other examples :to print an asml file use ./mincamlc -asml simple.ml -o simple.asml
to output arm ./mincamlc simple.ml -o simple.s
Other options :
-o
Specify output file (default a.out)
-v
Display the version
-t
Type check only
-p
Parse only
-asml
Output ASML only
-linear
Use linear
-opt
Use optimisation
-h
print help
To run all the tests :
$ make test
To run specific tests :
$ make test_asml
$ make test_gencode
$ make test_typecheck
$ make test_teacher
To generate the Sierpinsky triangle :
$ make sierpinsky
To benchmark the compiler against ocamlbuild :
$ make benchmark