(Work In Progress - what is here is tested and works but nothing is documented yet, sorry.)
This is a port of some of the parser-combinators from Haskell's Megaparsec library into Python. For use with the Parsy parser library for Python.
My motivation for this project was to build an indentation-sensitive parser. This is problematic for any parser library which is limited to expressing only context-free grammars (which is most of them), unless you use a separate pre-processing step (like e.g. the parser for the Python language does).
Googling around this topic I came upon https://markkarpov.com/tutorial/megaparsec.html#indentationsensitive-parsing
So in Haskell-land we can find 'Monadic Parser Combinators', which do not have this restriction to CFGs. And Megaparsec defines many useful combinators, including some which are designed specifically to help with building indentation-sensitive parsers.
Parser-combinators are nicely and simply explained in this YouTube video:
So in Megaparsy I have ported a bunch of the Megaparsec combinators over to Parsy. (I haven't done all of them yet, but the indentation-sensitive ones are here).
I've also translated across the property-based tests from their Haskell QuickCheck originals into Python Hypothesis ones.