diff --git a/.github/workflows/ghc.yml b/.github/workflows/ghc.yml index 9b8b86911..29c358bfe 100644 --- a/.github/workflows/ghc.yml +++ b/.github/workflows/ghc.yml @@ -23,11 +23,16 @@ name: GHC (build, test, haddock) # Controls when the workflow will run -on: +'on': push: - branches: [master] + branches: + - master tags: [v*] + paths-ignore: [ 'README.md' ] pull_request: + branches: + - master + paths-ignore: [ 'README.md' ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml new file mode 100644 index 000000000..52f0499da --- /dev/null +++ b/.github/workflows/markdown-lint.yml @@ -0,0 +1,38 @@ +# The MIT License (MIT) +# +# Copyright (c) 2016-2024 Objectionary.com +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- +name: markdown-lint +'on': + push: + branches: + - master + pull_request: + branches: + - master +jobs: + markdown-lint: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: articulate/actions-markdownlint@v1 + with: + files: 'README.md' diff --git a/README.md b/README.md index 79007cb91..f711039c9 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,54 @@ [![Hits-of-Code](https://hitsofcode.com/github/objectionary/eo-phi-normalizer?branch=master&label=Hits-of-Code)](https://hitsofcode.com/github/objectionary/eo-phi-normalizer/view?branch=master&label=Hits-of-Code) ![Lines of code](https://sloc.xyz/github/objectionary/eo-phi-normalizer) -Command line normalizer of 𝜑-calculus expressions (as produced by the [EO compiler](https://github.com/objectionary/eo)). +This command line tool helps you deal with 𝜑-calculus expressions, usually +produced by the [EO compiler][eo]. -Consult the [project documentation](https://www.objectionary.com/eo-phi-normalizer/) for more details. +First, install it (you should install [Stack][stack] first): + +```bash +stack update +stack install eo-phi-normalizer +``` + +Then, normalize a simple 𝜑-expression: + +```bash +$ cat > foo.phi +{⟦ m ↦ ⟦ x ↦ ⟦ ρ ↦ ∅ ⟧.ρ.k, k ↦ ⟦ Δ ⤍ 42- ⟧ ⟧.x ⟧} +$ eo-phi-normalizer rewrite --chain --tex foo.phi +``` + +The output will contain a ready-to-use LaTeX document, where all +rewritting steps are explained. + +More detailed documentation is [here][site]. + +## How to use custom rules? + +By default, the rules of normalization of 𝜑-calculus are used. They are +defined in the [rules.yaml][rules] file. You can use your own rules, with the +help of our custom YAML format, for example in `forty-three.yml`: + +```yaml +title: "forty-three" +rules: + - name: forty-three + description: 'change 33 double to 42 double' + pattern: | + Φ.org.eolang.bytes ( α0 ↦ ⟦ Δ ⤍ 40-40-80-00-00-00-00-00 ⟧ ) + result: | + Φ.org.eolang.bytes ( α0 ↦ ⟦ Δ ⤍ 40-45-00-00-00-00-00-00 ⟧ ) + tests: [ ] +``` + +Then, use this file: + +```bash +eo-phi-normalizer rewrite --rules=forty-three.yml foo.phi +``` + +[site]: https://www.objectionary.com/eo-phi-normalizer/ +[stack]: https://docs.haskellstack.org/en/stable/install_and_upgrade/ +[eo]: https://github.com/objectionary/eo +[rules]: https://github.com/objectionary/eo-phi-normalizer/blob/master/eo-phi-normalizer/test/eo/phi/rules/new.yaml