jgosmann / bite-parser

Asynchronous parser taking incremental bites out of your byte input stream.

Home Page:https://jgosmann.github.io/bite-parser/docs/en/stable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CI and release pipeline Codecov coverage PyPI PyPI - Python Version PyPI - License

Welcome to bite-parser

Asynchronous parser taking incremental bites out of your byte input stream.

The bite-parser is a parser combinator library for Python. It is similar to PyParsing in that it allows the construction of grammars for parsing from simple building blocks in pure Python. This approach is also known as Parsing Expression Grammar (PEG). While PyParsing (and many other Python parsing libraries) only support string, bite-parser operates on bytes. In addition, bite-parser makes use of asyncio and can asynchronously generate parsed items from an input stream.

A typical use-case would be the parsing of a network protocol like IMAP. In fact, I wrote this library for the IMAP implementation of my dmarc-metrics-exporter.

Note

I have implemented the fundamental set of parsers, which should allow constructing most or all grammars recognizable by this type of parser. However, many convenience or higher level parsers are not yet implemented.

Other areas that still need improvement are:

  • Abilitiy to debug the parsing.
  • Better error messages.
  • Performance: Currently, only a basic recursive descent parser is implemented which can exhibit exponential worst case performance. This could be improved by implementing a packrat parser.

Important links

About

Asynchronous parser taking incremental bites out of your byte input stream.

https://jgosmann.github.io/bite-parser/docs/en/stable/

License:MIT License


Languages

Language:Python 100.0%