Metadata-Version: 2.4
Name: semble-grammars
Version: 0.1.1
Summary: Locally-cached tree-sitter grammar bundle for Semble, with no runtime downloads.
Author-email: MinishLab <info@minishlab.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/MinishLab/semble-grammars
Project-URL: Bug Reports, https://github.com/MinishLab/semble-grammars/issues
Project-URL: Source, https://github.com/MinishLab/semble-grammars
Keywords: tree-sitter,grammars,parsing,semble
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Natural Language :: English
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: tree-sitter<0.27,>=0.25
Provides-Extra: dev
Requires-Dist: mypy>=1.0; extra == "dev"
Requires-Dist: pre-commit>=3.0; extra == "dev"
Requires-Dist: pydoclint>=0.5.3; extra == "dev"
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Requires-Dist: ruff>=0.9.0; extra == "dev"
Dynamic: license-file

# semble-grammars

Compiled [tree-sitter](https://tree-sitter.github.io/tree-sitter/) grammars for
[Semble](https://github.com/MinishLab/semble).

The package installs a platform-specific grammar archive and extracts individual
libraries to a local cache on first use. It does not access the network at
runtime.

```python
from semble_grammars import get_parser

parser = get_parser("python")
tree = parser.parse(b"def hello(): pass")
```

`available_languages()` lists the bundled languages. The package supports
macOS arm64 and x86-64, Linux arm64 and x86-64, and Windows arm64 and x86-64.

<details>
<summary>Included grammars (75)</summary>

The canonical names accepted by `get_parser()` are:

`asciidoc`, `astro`, `bash`, `c`, `clojure`, `cmake`, `cpp`, `csharp`, `css`,
`dart`, `dockerfile`, `dtd`, `elixir`, `embedded_template`, `erlang`, `fortran`,
`gitignore`, `go`, `gotmpl`, `graphql`, `groovy`, `haskell`, `hcl`, `html`,
`ini`, `java`, `javascript`, `jinja2`, `json`, `json5`, `jsonc`, `jsonnet`,
`julia`, `just`, `kdl`, `kotlin`, `latex`, `lua`, `make`, `markdown`,
`markdown_inline`, `nix`, `objc`, `ocaml`, `org`, `perl`, `php`, `php_only`,
`powershell`, `properties`, `proto`, `python`, `r`, `racket`, `rst`, `ruby`,
`rust`, `scala`, `scheme`, `scss`, `solidity`, `sql`, `starlark`, `svelte`,
`swift`, `toml`, `tsx`, `typescript`, `typst`, `vim`, `vue`, `wat`, `xml`,
`yaml`, `zig`.

`py` is an alias for `python`, and `terraform` is an alias for `hcl`.
</details>

Build grammars from the pinned sources in
[`sources.json`](src/semble_grammars/grammars/sources.json):

```bash
uv run python scripts/build_grammars.py           # current platform
uv run python scripts/build_grammars.py --windows # Windows via mingw-w64
uv run python scripts/build_grammars.py --all     # current, Linux, and Windows
```

This requires a C compiler, Git, and the tree-sitter CLI (`npm install -g
tree-sitter-cli@0.26.11`). Linux cross-builds also require Docker. Build the available
platform archives into wheels with:

```bash
uv run python scripts/build_wheels.py
```
