项目作者: Smoltbob

项目描述 :
MinCaml to ARM compiler
高级语言: OCaml
项目地址: git://github.com/Smoltbob/Caml-Est-Belle.git
创建时间: 2017-12-11T09:50:25Z
项目社区:https://github.com/Smoltbob/Caml-Est-Belle

开源协议:

下载


Caml-Est-Belle

MinCaml to ARM compiler.

Feel free to read the wiki for more documentation.

Presentation of of the project

Link

State of the project

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)

Installation

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.

Usage

A basic usage of the compiler is

  1. $ 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

Running the tests

To run all the tests :

  1. $ make test

To run specific tests :

  1. $ make test_asml
  2. $ make test_gencode
  3. $ make test_typecheck
  4. $ make test_teacher

Additional features

To generate the Sierpinsky triangle :

  1. $ make sierpinsky

To benchmark the compiler against ocamlbuild :

  1. $ make benchmark