eco is a native compiler and runtime for the Elm programming language. Eco compiles Elm to native x86 binaries via MLIR and LLVM. The compiler front-end is itself written in Elm. There is a C++ backend for the MLIR and LLVM portion.
The overall status of the 0.1.0 release is alpha, reflecting the immaturity of the code at this time. There will be bugs (please find some!), possible ever severe ones. The bundled kernel IO code is an internal compile API exposed for convenience; experiment with it but don't get too comfortable and don't rely on it. A more complete set of IO APIs will follow and replace this API.
The full pipeline works today: Elm source compiles through a typed AST, whole-program monomorphisation and optimisation, a custom MLIR dialect, and LLVM down to native binaries (AOT) or JIT execution, backed by a generational garbage collector and effect-manager runtime. Linux x86_64 and macOS arm64 (Apple Silicon) are both supported — see docs/building.md and docs/building-macos.md.
The compiler is capable of building itself, which is a complex 160K LOC program, which goes along way towards proving the implementation is real-world capable.
- Getting Started - Getting started with the release bundle.
- Building — Docker images, distribution bundles, the dev environment, CMake presets, and building on a Linux host.
- Building on macOS — Apple Silicon native build: Xcode CLT, brew deps, mac presets, AOT bundle.
- Testing — the elm-test, end-to-end, and stress suites.
- Bootstrap — the 9-stage self-compilation pipeline.
- Build targets — reference for every CMake target.
- Options and flags — every CLI flag, environment variable,
eco-config.jsonkey, heap/GC setting and CMake option, with defaults.
Dowload a Release from eco-compiler Github repo, then follow the getting started instructions.
The recommended path is the Docker dev image, which bundles LLVM/MLIR, the C++ toolchain, and the Elm tooling. Build the base and dev images (one-off, ~30–60 min for LLVM), then build and test:
# Build the LLVM/MLIR base and the dev image (see docs/building.md for detail).
docker build -f docker/llvm-debian.Dockerfile -t eco-llvm-debian:21.1.8 .
docker build -f docker/eco-dev.Dockerfile -t eco-dev .
# Configure and run the full build + test suite inside the image.
docker run --rm -v "$PWD":/work eco-dev bash -c \
"cmake --preset build && cmake --build build --target full"Once the compiler is bootstrapped, compile and run an Elm program with the
unified eco binary — a drop-in replacement for elm make:
cd examples
eco make src/Hello.elm --output=hello # → native ELF executable
./hello # → Hello World!The Eco compiler frontend is forked from Guida, an Elm compiler port. Guida is itself a port of the original Elm compiler by Evan Czaplicki.