A razor sharp, experimental parser-combinator library for Python. It's goals include being composable, easy to understand, and elegant while being reasonably performant. Katana is being built with a functional style- immutable data structures, no mutation and requires the pyrsistent library.
Katana requires a strict separation of the tokenisation and parsing phase; tokenisation is done via regexes and parsing is simply the grouping of those tokens:
from katana.scanner import rexpr, scan
dollar = rexpr(r'\$')
number = rexpr(r'[0-9]+')
tokens = scan([dollar, number], '$123')
Then the parsing phase:
from katana.term import term
from katana.compound import sequence
from katana.utils import parse
dollar_term = term(dollar)
number_term = term(number)
usd = sequence(dollar_term, number_term)
parse(usd, tokens)