- Symbolic algebra: declare symbolic variables, compose arithmetic expressions, and evaluate them with concrete values at runtime.
- Statically typed: type-checked at compile time.
df main() i32 {
sym x: expr<i32>;
sym y: expr<i32>;
sym z: expr<i32>;
let a: expr<i32> = x + 5;
let b: expr<i32> = 3 * y;
let c: expr<i32> = 2 * z + 1;
return c[x=10] + b[y=10] + a[z=10];
}LLVM/MLIR 22 is required. After installing, set:
export LLVM_SYS_221_PREFIX=/path/to/llvm-22
export MLIR_SYS_220_PREFIX=/path/to/llvm-22
export TABLEGEN_220_PREFIX=/path/to/llvm-22Installing LLVM/MLIR (click to expand)
brew install llvm@22
export LLVM_SYS_221_PREFIX=$(brew --prefix llvm@22)
export MLIR_SYS_220_PREFIX=$(brew --prefix llvm@22)
export TABLEGEN_220_PREFIX=$(brew --prefix llvm@22)You may also need:
export LIBRARY_PATH=/opt/homebrew/libRequires ~6 GB RAM and ~20 GB disk space.
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
git checkout llvmorg-22.1.8
cmake -G Ninja ../llvm \
-DLLVM_ENABLE_PROJECTS="mlir" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DLLVM_ENABLE_ASSERTIONS=On \
-DLLVM_BUILD_LLVM_DYLIB=On \
-DLLVM_LINK_LLVM_DYLIB=On \
-DMLIR_BUILD_MLIR_C_DYLIB=On \
-DLLVM_TARGETS_TO_BUILD=host \
-DCMAKE_INSTALL_PREFIX=/opt/llvm-22 \
-DLLVM_USE_LINKER=mold # optional, faster with mold
ninja installcargo install mathic# Create a new project
euler new <name>
cd <name>
# Compile and run the project in the current directory (requires src/main.mth)
euler runOptions for euler run:
euler run --opt-lvl <O0|O1|O2|O3> # optimization level (default O2)
euler run --dump-mathir # dump MATHIR to mathir_dumps/
euler run --dump-mlir # dump MLIR to mlir_dumps/
euler run --dump-llvmir # dump LLVM IRSee docs/ for the full project structure and pipeline.
See CONTRIBUTING.md.
Early development. Features are added incrementally. The symbolic dialect and its lowering passes are functional but evolving.
Built with ❤️ and 🦀 Rust