Skip to main content

Python parsing module

Project description

====================================
PyParsing -- A Python Parsing Module
====================================

Introduction
============

The pyparsing module is an alternative approach to creating and executing
simple grammars, vs. the traditional lex/yacc approach, or the use of
regular expressions. The pyparsing module provides a library of classes
that client code uses to construct the grammar directly in Python code.

Here is a program to parse "Hello, World!" (or any greeting of the form
"<salutation>, <addressee>!"):

from pyparsing import Word, alphas
greet = Word( alphas ) + "," + Word( alphas ) + "!"
hello = "Hello, World!"
print hello, "->", greet.parseString( hello )

The program outputs the following:

Hello, World! -> ['Hello', ',', 'World', '!']

The Python representation of the grammar is quite readable, owing to the
self-explanatory class names, and the use of '+', '|' and '^' operator
definitions.

The parsed results returned from parseString() can be accessed as a
nested list, a dictionary, or an object with named attributes.

The pyparsing module handles some of the problems that are typically
vexing when writing text parsers:
- extra or missing whitespace (the above program will also handle
"Hello,World!", "Hello , World !", etc.)
- quoted strings
- embedded comments

The .zip file includes examples of a simple SQL parser, simple CORBA IDL
parser, a config file parser, a chemical formula parser, and a four-
function algebraic notation parser. It also includes a simple how-to
document, and a UML class diagram of the library's classes.



Installation
============

Do the usual:

python setup.py install

(pyparsing requires Python 2.3.2 or later.)


Documentation
=============

See:

HowToUsePyparsing.html


License
=======

MIT License. See header of pyparsing.py

History
=======

See CHANGES file.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

pyparsing-1.5.7.zip (965.0 kB view details)

Uploaded Source

pyparsing-1.5.7.tar.gz (939.6 kB view details)

Uploaded Source

Built Distributions

pyparsing-1.5.7.win32-py2.7.exe (231.7 kB view details)

Uploaded Source

pyparsing-1.5.7.win32-py2.6.exe (231.7 kB view details)

Uploaded Source

pyparsing-1.5.7.win32-py2.5.exe (101.1 kB view details)

Uploaded Source

File details

Details for the file pyparsing-1.5.7.zip.

File metadata

  • Download URL: pyparsing-1.5.7.zip
  • Upload date:
  • Size: 965.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyparsing-1.5.7.zip
Algorithm Hash digest
SHA256 8a6329d4679fb249d4e0a4afbae6e041f9abbc299920d6efe5d8c4e9fb1407bc
MD5 b86854857a368d6ccb4d5b6e76d0637f
BLAKE2b-256 2e26e8fb5b4256a5f5036be7ce115ef8db8d06bc537becfbdc46c6af008314ee

See more details on using hashes here.

File details

Details for the file pyparsing-1.5.7.tar.gz.

File metadata

  • Download URL: pyparsing-1.5.7.tar.gz
  • Upload date:
  • Size: 939.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyparsing-1.5.7.tar.gz
Algorithm Hash digest
SHA256 646e14f90b3689b005c19ac9b6b390c9a39bf976481849993e277d7380e6e79f
MD5 9be0fcdcc595199c646ab317c1d9a709
BLAKE2b-256 6f2c47457771c02a8ff0f302b695e094ec309e30452232bd79198ee94fda689f

See more details on using hashes here.

File details

Details for the file pyparsing-1.5.7.win32-py2.7.exe.

File metadata

File hashes

Hashes for pyparsing-1.5.7.win32-py2.7.exe
Algorithm Hash digest
SHA256 b21232cef657a2477036374c5790b4bbeee3f02efece80b8b68c69e0104dde6c
MD5 6b3c2fa6c6ad93c506117a31ade2f3ba
BLAKE2b-256 2f74078bee51e3439579eee83238d0b614d63e8c8da155a56bea336eeed59b6c

See more details on using hashes here.

File details

Details for the file pyparsing-1.5.7.win32-py2.6.exe.

File metadata

File hashes

Hashes for pyparsing-1.5.7.win32-py2.6.exe
Algorithm Hash digest
SHA256 3b417014a66d0896c73f0ac77b4f4c7e2c06eb2e11ddcab2f5ed14a7348a461d
MD5 0f0a4ced918720f3dbc4918a427de3a9
BLAKE2b-256 223ed3cef8d938cee7609c968ca73fefb12caab55243034fb31dff80a6dadfaf

See more details on using hashes here.

File details

Details for the file pyparsing-1.5.7.win32-py2.5.exe.

File metadata

File hashes

Hashes for pyparsing-1.5.7.win32-py2.5.exe
Algorithm Hash digest
SHA256 cac34e3620a34b7e6888d82dd62ebcf322b7c62c94c7a2816808dc37a3ec6256
MD5 b3c8a69846c0c3c00d15a75dc99f137a
BLAKE2b-256 927d7f4027d01213931929c2c6a599da3f9c05efa3a3758be34ce4c391d65b43

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page