1. Kazuhiro Matsushima
  2. PyParsec



1 Introduction

PyParsec is an object-based parser combinator library for Python.

This library is currently under development, and may have some bugs.

PyParsec supports Python 3, and does not support Python 2.

2 Usage

When you want to create large expressions, you can construct parsers by combining Combinator methods.

Parsers are made as 'usual Python classes' so you can write them in your Python codes.

3 Examples

>>> from pyparsec.primitives import symbol
>>> from pyparsec.char_parser import pfloat
>>> parser = symbol('a')
>>> parser.parse("abcde").result()
('a', 'bcde')
>>> p = symbol('(')
>>> q = symbol(')')
>>> p.pandr(parser).pandl(q).pconv(lambda s: s.upper()).parse("(a)bcde").result()
('A', 'bcde')

4 License

Copyright (c) 2011-2013, Gab_km

Version 0.7 is licensed under the MIT License.

See: ./MIT