Use this page to post submissions to the pyparsers package. This package serves as a library of common, reusable, extensible parsers. (Please do not post parsers that you cannot distribute under an MIT or MIT-like license.)

The pyparser API

For consistency of use, submitted pyparsers should conform to a common API:
- each pyparser is accessed through a single class
- the class implements the parser() method and... ?
- the parsers are extended by... ?

searchparser (add link to file here, similar to the pyparsing/Examples page)

searchparser does...

Here's a modification of the example with keyword and range support:

Here's another example based in part on and some other work done on a Xapian query language. It is a generic language that provides searchparser like customization of query action by subclassing a query object interpreter.

A simple macro parser

Here's a simple parser that parses '#macro-name {block}'. You can use PyParsing's scanString method to find all instances of macros and replace them with modified strings. For example, '#i{#b{text}}' can be transformed to '<i><b>text</b></i>'. While the grammar is relatively simple and lacks any real functionality, it shows how to construct a recursive grammar with actions to construct useable output.