(mini)ML compiler 💡
Take a look at the testsuite to get a grasp of what's supported
The following features are implemented:
- HM Type checker
- functions
- tuples
- runtime primitives (e.g.
print) - simple copying GC
Backends:
- RISC V (the most mature one)
- AMD64
- LLVM
Install dependencies using opam
opam install --deps-only --with-doc --with-dev-setup .Build the project and run some tests
dune build
dune runtestUse the driver to compile some examples
dune exec driver -- testsuite/tests/fac.ml --target rv64 -o fac.sOn the first run of dune build rukaml discovers your environment
discover: discovering AMD64 compiler
discover: "x86_64-unknown-linux-gnu-gcc" is not available
discover: ((compile ()) (assemble ()) (link ()) (run ()))
discover: discovering RV64 compiler
discover: discovering RV64 assembler
discover: discovering RV64 linker
discover: discovering RV64 runner
discover: ((compile ("riscv64-unknown-linux-gnu-gcc -g -fPIC -Wall -Wpedantic"))
(assemble ("riscv64-unknown-linux-gnu-gcc -x assembler -c"))
(link ("riscv64-unknown-linux-gnu-gcc "))
(run ("qemu-riscv64 -L /opt/rv64/sysroot")))
If some target's toolchain is not found tests in the testsuite for this target are automatically skipped.
To configure discover use environment variables.
E.g. consider the following direnv .envrc
to compile and run amd64 tests natively:
export CC_AMD64=gcc
export LD_AMD64=gcc
export RUN_AMD64=""
export RUN_FLAGS_AMD64=""
Once the environment is properly discovered run the testsuite:
make testsuite WATCH=1For more information on the testsuite see its README