Mercurial > lbo > hg > pcombinators
view README.md @ 1:57092e2bbe6c draft
Add LICENSE and README
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sun, 19 May 2019 12:16:53 +0200 |
parents | |
children | ba01d60dd2fc |
line wrap: on
line source
# pcombinators Working on parser combinators for Python, in an understandable manner. I've always been fascinated by them, so I wanted to try if I can implement them :-) For example: ```python import pcombinators.combinators as c st = c.ParseState('Hello, World!') p = c.String('Hello') + c.Regex('([,.]) +') + c.String('World') + c.Regex('[.,?!]') p.parse(st) # >> (['Hello', ',', 'World', '!'], ParseState(Hello, World!<>))<Paste> ```