(このドキュメントの日本語バージョン: CONTRIBUTING.ja.md)
Please use Stack for development.
If you are using Ubuntu, you can install Stack with $ sudo apt install haskell-stack
.
To run Jikka after you modified the source code, use the following commands:
$ stack run convert XXX.py
runs Jikka which is locally built withsrc/
$ stack run -- convert --target core XXX.py
prints our core language instead of C++$ stack run -- convert --target rpython XXX.py
prints our restricted Python instead of C++$ stack run execute XXX.py < YYY.in
executes AST of our core language directly$ stack run -- execute -- --target rpython XXX.py < YYY.in
executes AST of our restricted Python directly$ python3 XXX.py < YYY.in'
or$ python3 -c 'import XXX; print(XXX.main(1, 2, [3, 4, 5]))'
runs as the standard Python$ stack run convert --source core --target core XXX.jikka
optimizes exprs of our core language$ stack run convert --source core XXX.jikka
converts exprs of our core language to C++
Use the following commands to run tests. Hspec and Doctest are enabled. Also contents of examples/ directory are verified.
$ stack test
$ python3 examples/integration_tests.py
The GitHub Actions for tests is defined at .github/workflows/test.yml.
$ python3 scripts/integration_tests.py
runs tests using files under examples/.
For each Python file examples/XXX.py
, it finds test cases like examples/data/XXX.YYY.in
examples/data/XXX.YYY.out
or generates test cases from examples/data/XXX.ZZZ.generator.py
examples/data/XXX.solver.py
, and then executes it as Python / our restricted Python / our core / C++, and verifies the results.
With $ python3 scripts/integration_tests.py -k XXX
, you can run only specific tests which contains XXX
in its file name.
We are collecting more test cases. When you solved a real problems of competitive programmings using Jikka, please send a pull request which adds it as a new test case.
There is a script at scripte/pre-commit
which checkes formatting of all files.
We recommend to configure this as the pre-commit hook with running $ ln -s $(pwd)/scripts/pre-commit .git/hooks/pre-commit
.
Ormolu and HLint are enabled. Use the following commands to check formatting.
$ stack exec ormolu -- --mode=check $(find src app test -name \*.hs)
$ stack exec hlint -- src app test
Use the following command to fix formatting automatically as possible.
$ stack exec ormolu -- --mode=check $(find src app test -name \*.hs)
The GitHub Actions for formatting if defined at .github/workflows/format.yml.
clang-format is enabled.
yapf and isort are enabled.
You can install these with $ pip3 install -r scripts/requirements.txt
.
Prettier is enabled.
you can install this with installing Yarn and running $ yarn install
.
Prettier is enabled.
you can install this with installing Yarn and running $ yarn install
.
Haddock is used for internal documents of internal implementation. Run the following command to generate documents locally.
$ stack haddock
Use Conventional Commits.
Conforming to Haskell Package Versioning Policy.