Metadata-Version: 2.4
Name: gbnf
Version: 0.0.32
Summary: A library for parsing GBNF grammars
Author-email: Ambient Labs <maintainers@gbnf.dev>
Project-URL: Homepage, https://github.com/ambient-labs/GBNF/packages/gbnf
Project-URL: Bug Tracker, https://github.com/ambient-labs/GBNF/packages/gbnf/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pytest-watcher>=0.4.3
Dynamic: license-file

# GBNF

<a href="https://pypi.org/project/gbnf"><img alt="Latest GBNF PyPI Version" src="https://badge.fury.io/py/gbnf.svg" /></a>
<a href="https://github.com/ambient-labs/GBNF/packages/gbnf/blob/master/LICENSE"><img alt="License for gbnf" src="https://img.shields.io/pypi/l/gbnf" /></a>
<a href="https://pypi.org/project/gbnf"><img alt="Downloads per week on PyPI for gbnf" src="https://img.shields.io/pypi/dw/gbnf" /></a>
<a href="https://github.com/ambient-labs/GBNF/packages/gbnf/actions/workflows/tests.yaml"><img src="https://github.com/ambient-labs/GBNF/packages/gbnf/actions/workflows/tests.yaml/badge.svg" alt="Status of tests for gbnf repository" /></a>
<a href="https://codecov.io/gh/ambient-labs/gbnf"><img alt="Code Coverage for gbnf" src="https://img.shields.io/codecov/c/github/ambient-labs/gbnf" /></a>
<a href="https://deepsource.io/gh/ambient-labs/gbnf/?ref=repository-badge"><img alt="DeepSource issues for gbnf" src="https://deepsource.io/gh/ambient-labs/gbnf.svg/?label=active+issues&show_trend=true" /></a>

A library for parsing `.gbnf` grammar files in Python.

## Install

```bash
pip install gbnf
```

## Repetition syntax

The grammar supports bounded repetition on the preceding symbol or group:

```gbnf
root ::= "a"{3}     # exactly 3 times
root ::= "a"{2,}    # at least 2 times
root ::= "a"{2,4}   # between 2 and 4 times (inclusive)
root ::= "a"{0,4}   # at most 4 times (inclusive)
```
