In the same way to other Haskell softwares, Nirum compiler can be built using Haskell Stack. If you didn't install it yet see also its installation guide.
If it's your first build of Nirum compiler you need to setup a proper version of GHC:
stack setup
The following command builds an executable binary of Nirum compiler:
stack build
A built executable binary aren't installed to PATH
until stack install
command is run. Without installation a built executable binary can be invoked
using stack exec
command:
stack exec -- nirum -t python -o out/ examples/
Note that --
indicates options after it belong to the nirum
executable,
not stack exec
command.
Since it is a compiler which generate source codes, there are two scopes we should test:
- the compiler itself, and
- codes that the compiler generates.
The former is unit testing and the latter one is integration testing. We have two commands/scripts to run corresponding testing:
stack test :spec
stack test :targets
If you've changed things related to a target backend you should test everything:
stack test
If you've changed pure internals of the compiler probably it's okay to run only the former command. Anyway both testings are run by CI so that changes breaking either testing cannot be merged.
Each target test suite has its external dependencies (i.e., non-library program dependencies):
- Python
- All Python versions that Nirum should support: Python 2.7, and 3.4 and above all
tox
3.0.0 or higher
Since we want to keep our coding style consistently, we run lint to check it. You can get more information about hlint on its homepage.
We recommend you to register lint to Git hooks.
ln -s "$PWD/lint.sh" "$PWD/.git/hooks/pre-commit"
If you have registered a hook once, it will be automatically executed when you make a commit.
We believe logging changes is a part of making software. So we have the policy enforcing every pull request to have an entry to changelog (i.e., a diff on CHANGES.md file) on the CI.
Please put [chagelog skip]
on commit message if your change is not related to
the Nirum compiler (e.g., fixing a typo).