[TOC]
Support | |
License | |
Tests |
MimIR is an extensible compiler intermediate representation that is based upon the Calculus of Constructions (CoC). This means:
In contrast to other CoC-based program representations such as Coq or Lean, MimIR is not a theorem prover but focuses on generating efficient code. For this reason, MimIR explicitly features mutable state and models imperative control flow with continuation-passing style (CPS).
You can use MimIR either via it's C++-API or through its frontend language Mim.
If you have a GitHub account setup with SSH, just do this:
git clone --recurse-submodules git@github.com:AnyDSL/MimIR.git
Otherwise, clone via HTTPS:
git clone --recurse-submodules https://github.com/AnyDSL/MimIR.git
Then, build with:
cd mim
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j $(nproc)
For a Release
build simply use -DCMAKE_BUILD_TYPE=Release
.
If you want to install MimIR, specify an install prefix and build the target install
:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/my/local/install/prefix
cmake --build build -j $(nproc) -t install
CMake Switch | Options | Default | Comment |
---|---|---|---|
CMAKE_BUILD_TYPE |
Debug | Release | RelWithDebInfo |
Debug |
Build type. |
CMAKE_INSTALL_PREFIX |
/usr/local |
Install prefix. | |
MIM_BUILD_DOCS |
ON | OFF |
OFF |
If ON , build the documentation (requires Doxygen). |
MIM_BUILD_EXAMPLES |
ON | OFF |
OFF |
If ON , build the examples. |
MIM_ENABLE_CHECKS |
ON | OFF |
ON |
If ON , enables expensive runtime checks (requires CMAKE_BUILD_TYPE=Debug ). |
BUILD_TESTING |
ON | OFF |
OFF |
If ON , build all unit and lit tests. |
MIM_LIT_TIMEOUT |
<timeout_in_sec> |
10 |
Timeout for lit tests. (requires BUILD_TESTING=ON ). |
MIM_LIT_WITH_VALGRIND |
ON | OFF |
OFF |
If ON , the Mim CLI in the lit tests will be run under valgrind. (requires BUILD_TESTING=ON ). |
In addition to the provided submodules:
-
Recent version of CMake
-
A C++20-compatible C++ compiler.
-
While Mim emits LLVM, it does not link against LLVM.
Simply toss the emitted
*.ll
file to your system's LLVM toolchain. But technically, you don't need LLVM.
MimIR is a recursive acronym for MimIR is my intermediate Representation. Mímir or Mim is also a figure in Norse mythology, renowned for his knowledge and wisdom, who is beheaded during the Æsir–Vanir War. Afterward, the god Odin carries around Mímir's head and it recites secret knowledge and counsel to him. Now, you have Mímir's head at your fingertips.
We use the term MimIR, if we speak of the internal graph-based representation and its C++-API, and the term Mim, if we mean MimIR's frontend language.
To keep things short and simple, all code consistently uses mim
or MIM
for namespaces, macro prefixes, etc.
And if in doubt, just use Mim.