All Projects → coord-e → Mlml

coord-e / Mlml

Licence: mit
self-hosted compiler for a subset of OCaml

Programming Languages

ocaml
1615 projects

Projects that are alternatives of or similar to Mlml

Pyast64
Compile a subset of the Python AST to x64-64 assembler
Stars: ✭ 93 (+126.83%)
Mutual labels:  compiler, x86-64
Wag
WebAssembly compiler implemented in Go
Stars: ✭ 177 (+331.71%)
Mutual labels:  compiler, x86-64
Peachpy
x86-64 assembler embedded in Python
Stars: ✭ 1,592 (+3782.93%)
Mutual labels:  compiler, x86-64
Babygo
Go compiler made from scratch, which can compile itself. It's going to be the smallest and simplest go compiler in the world.
Stars: ✭ 143 (+248.78%)
Mutual labels:  compiler, x86-64
Lbforth
Self-hosting metacompiled Forth, bootstrapping from a few lines of C; targets Linux, Windows, ARM, RISC-V, 68000, PDP-11, asm.js.
Stars: ✭ 293 (+614.63%)
Mutual labels:  self-hosted, compiler
Jit Compiler
JIT compiler in Go
Stars: ✭ 70 (+70.73%)
Mutual labels:  compiler, x86-64
Crust
C compiler toolchain in Rust. [WIP, early development stage]
Stars: ✭ 150 (+265.85%)
Mutual labels:  compiler, x86-64
Mir
A light-weight JIT compiler based on MIR (Medium Internal Representation)
Stars: ✭ 1,075 (+2521.95%)
Mutual labels:  compiler, x86-64
Asmjit
Machine code generation for C++
Stars: ✭ 2,874 (+6909.76%)
Mutual labels:  compiler, x86-64
Ppci
A compiler for ARM, X86, MSP430, xtensa and more implemented in pure Python
Stars: ✭ 210 (+412.2%)
Mutual labels:  compiler, x86-64
Minijit
A basic x86-64 JIT compiler written from scratch in stock Python
Stars: ✭ 185 (+351.22%)
Mutual labels:  compiler, x86-64
Mazucc
A minimalist C compiler with x86_64 code generation
Stars: ✭ 437 (+965.85%)
Mutual labels:  compiler, x86-64
Dora
Dora VM
Stars: ✭ 371 (+804.88%)
Mutual labels:  compiler, x86-64
Dynarmic
An ARM dynamic recompiler.
Stars: ✭ 475 (+1058.54%)
Mutual labels:  compiler, x86-64
Exoframe
Exoframe is a self-hosted tool that allows simple one-command deployments using Docker
Stars: ✭ 972 (+2270.73%)
Mutual labels:  self-hosted
Smallerc
Simple C compiler
Stars: ✭ 986 (+2304.88%)
Mutual labels:  compiler
Opentorrentsite
A modern torrent site template that is easy to setup with an intuitive GUI. Currently in development.
Stars: ✭ 34 (-17.07%)
Mutual labels:  self-hosted
Pytlas
An open-source 🤖💬 Python 3 assistant library built for people and made to be super easy to setup and understand
Stars: ✭ 34 (-17.07%)
Mutual labels:  self-hosted
Iotz
compile things easy 🚀
Stars: ✭ 39 (-4.88%)
Mutual labels:  compiler
Forsaken Mail
a self-hosted disposable mail service
Stars: ✭ 974 (+2275.61%)
Mutual labels:  self-hosted

mlml

Build Status Coverage Status Docker Cloud Automated build Docker Cloud Build Status MicroBadger Image

mlml is a self-hosted toy compiler for a tiny subset of OCaml.

a detailed description can be found in my blog post (in Japanese): 自作OCamlコンパイラでセルフホストした - molecular coordinates

roadmap

  • [x] basic arithmetic
  • [x] variables
  • [x] if-then-else
  • [x] functions
    • [x] recursion
    • [x] mutual recursion
    • [x] closure
    • [x] currying
  • [x] tuples
  • [x] variants
  • [x] records
  • [x] pattern matching
  • [x] structual comparison
  • [x] primitive types
    • [x] string
    • [x] list
    • [x] bytes
    • [x] array
  • [x] formatted output with Printf
  • [x] modules
    • [x] definition
    • [x] aliases
    • [x] open
    • [x] dune-like bundler
  • [x] self-hosting!
  • [ ] exceptions
  • [ ] type checker & type inference

self hosting

mlml is self-hosted. i.e. mlml can compile itself.

./dev/exec.sh ./dev/self_host.sh

To obtain build artifacts, pass a path to local directory as below. You will see compiled binaries under ./self_host.

mkdir self_host
./dev/exec.sh ./dev/self_host.sh ./self_host

limitations

  • external definitions are only available for functions
  • all modules and paths are statically-resolved
  • all custom oeprators are left-associative
  • function keyword does not make an expression

development

If you have docker installed in your system, simply run

./dev/start.sh

to start the development.

You can run tests manually by running the following command:

./dev/exec.sh dune runtest

thanks

The code and algorithm in parser and lexer is strongly inspired by ushitora-anqou/aqaml

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].