Magnolia is a research programming language based on the theory of institutions.
As of May 2022, this repository guides the evolution of Magnolia and hosts
the magnoliac
compiler.
To install the Magnolia compiler, simply run the following command:
make install
magnoliac
will then be installed in the default directory for your cabal
binaries. By default, this should be ~/.cabal/bin
. Make sure that directory
is in your PATH
.
To build a Magnolia program, use the build
command as follows:
magnoliac build <path/to/package.mg> --output-directory <path/to/generated/files>
By default, this command does NOT overwrite files. In order to re-generate
previously generated programs in the same output directory, you can explicitly
add the --allow-overwrite
flag to your command.
Another option to explore Magnolia source files is to explore them using the
repl
option instead:
magnoliac repl
mgn> help
Available commands are:
help: show this help menu
inspectm: inspect a module
inspectp: inspect a package
list: list the loaded packages
load: load a package
reload: reload a package
For example, given a file named "example.mg"
at the root of the repo, one can
load it and inspect its contents like so:
mgn> load example
mgn> inspectp example
SomeSig
SomeConcept
SomeOtherConcept
The compiler has been tested with GHC 8.10.3 and is built using cabal
.
A very simplistic Makefile is provided, and the following should be sufficient
to get going with a development version of the compiler:
make build
# For convenience, you may define an alias for the compiler
alias magnoliac='cabal exec magnoliac --'
Feel free to open issues and pull requests!
We roughly follow the same guidelines as specified in the Futhark project. Most importantly:
- lines should (as much as possible) be under 80 characters long;
- we use 2 spaces for indent.