|
MimIR 0.1
MimIR is my Intermediate Representation
|
Check out the demo plugin for a minimal example. It uses our custom add_mim_plugin CMake command. A plugin generally consists of two halves with the same name: a <plugin>.mim file that declares the public annexes and a shared library that registers the runtime behavior.
Plugin names may only contain letters, digits, and underscores, and are limited to 8 characters.
Create a new in-tree plugin foobar based on the demo plugin:
The script also supports -h/--help and prints the same usage text when called incorrectly.
By default, the script creates an in-tree plugin and updates src/mim/plug/CMakeLists.txt. The generated files are:
To create a self-contained third-party plugin repository in extra/, use:
This creates extra/<plugin>/ with:
In --extra mode, the script also initializes a new Git repository for the plugin.
If you clone a plugin repository into extra/, MimIR picks it up automatically during configuration when the repository contains a CMakeLists.txt as a direct child of extra/.
If the plugin repository also contains lit/*.mim tests, they are picked up automatically by the main lit target as well.
To move an existing in-tree plugin into extra/foobar, use:
This moves:
It also rewrites the extracted CMakeLists.txt for out-of-tree use and removes the plugin from the in-tree plugin list so it is picked up through extra/ instead.
After installing MimIR, a third-party plugin only needs to find the mim package. For example, a plugin called foo can be set up like this:
Configure the project standalone with:
The authoritative reference for add_mim_plugin itself lives in cmake/Mim.cmake.
Normalizers usually obtain the owning World from one of their arguments, often type->world(), and then build the replacement directly in that world. Small normalizers are expected to be direct and side-effect free.
That often leads to tiny functions of the form: