Skip to content

therain7/kukaml

 
 

rukaml

Build License API docs

(mini)ML compiler 💡

Features

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

Getting started

Install dependencies using opam

opam install --deps-only --with-doc --with-dev-setup .

Build the project and run some tests

dune build
dune runtest

Use the driver to compile some examples

dune exec driver -- testsuite/tests/fac.ml --target rv64 -o fac.s

discover the environment and run the testsuite

On 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=1

For more information on the testsuite see its README

About

idk

Resources

License

LGPL-3.0 and 2 other licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
MIT
LICENSE.MIT

Stars

Watchers

Forks

Languages

  • OCaml 91.2%
  • C 8.3%
  • Other 0.5%