Metadata-Version: 2.4
Name: aspen-tree-5
Version: 0.2.0
Summary: aspen is a tool for analyzing and manipulating ASTs in the clingo ASP language, powered by tree-sitter.
Author-email: Amadé Nemes <nemesamade@gmail.com>
License: MIT License
        
        Copyright (c) 2024 Amadé Nemes
        
        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 NONINFRINGEMENT. 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.
        
Project-URL: Homepage, https://github.com/potassco/aspen-tree
Project-URL: Documentation, https://docs.potassco.org/aspen-tree/
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: clingo
Requires-Dist: tree-sitter==0.25.2
Provides-Extra: format
Requires-Dist: black; extra == "format"
Requires-Dist: isort; extra == "format"
Requires-Dist: autoflake; extra == "format"
Provides-Extra: lint-pylint
Requires-Dist: pylint; extra == "lint-pylint"
Requires-Dist: aspen-tree-5[test]; extra == "lint-pylint"
Provides-Extra: typecheck
Requires-Dist: types-setuptools; extra == "typecheck"
Requires-Dist: mypy; extra == "typecheck"
Requires-Dist: tree-sitter-clingo; extra == "typecheck"
Requires-Dist: tree-sitter-metasp; extra == "typecheck"
Requires-Dist: tree-sitter-aspcore2; extra == "typecheck"
Provides-Extra: test
Requires-Dist: coverage[toml]; extra == "test"
Requires-Dist: tree-sitter-clingo; extra == "test"
Requires-Dist: tree-sitter-metasp; extra == "test"
Requires-Dist: tree-sitter-aspcore2; extra == "test"
Provides-Extra: doc
Requires-Dist: mkdocs; extra == "doc"
Requires-Dist: mkdocs-material; extra == "doc"
Requires-Dist: mkdocstrings[python]; extra == "doc"
Requires-Dist: mkdoclingo; extra == "doc"
Provides-Extra: lsp
Requires-Dist: python-lsp-server; extra == "lsp"
Requires-Dist: rope; extra == "lsp"
Requires-Dist: pylsp-mypy; extra == "lsp"
Requires-Dist: pylsp-rope; extra == "lsp"
Requires-Dist: python-lsp-black; extra == "lsp"
Provides-Extra: dev
Requires-Dist: aspen-tree-5[lint_pylint,lsp,test,typecheck]; extra == "dev"
Dynamic: license-file

# aspen-tree

aspen-tree analyzes and transforms programs written in any language with a
[tree-sitter](https://tree-sitter.github.io/) grammar, with transformations
written in answer set programming (ASP). It is mostly used for the
[clingo](https://potassco.org/clingo/) ASP language itself.

aspen-tree turns the syntax tree of a program into facts, and applies a
*meta-encoding*, an ordinary clingo program over these facts, which describes
edits of the program text. Everything not edited, such as layout and comments,
stays as it was. For example, renaming the identifier `b` to `c`:

```console
$ printf 'a :- b.\nb.\n' | aspen transform - -l clingo \
    -s 'aspen(replace(node(N), "c")) :- type(N, "identifier"), leaf_text(N, "b").'
a :- c.
c.
```

## Installation

To install the project, together with the grammar for clingo programs, run

```bash
pip install aspen-tree-5 tree-sitter-clingo
```

## Documentation

The documentation is available at <https://docs.potassco.org/aspen-tree/>. It
can also be built locally with

```bash
pip install .[doc]
mkdocs serve
```
