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.6 or later.)
Or corresponding commands using pip, easy_install, or wheel:
pip install pyparsing
easy_install pyparsing
wheel install pyparsing
Documentation
=============
See:
HowToUsePyparsing.html
License
=======
MIT License. See header of pyparsing.py
History
=======
See CHANGES file.
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.6 or later.)
Or corresponding commands using pip, easy_install, or wheel:
pip install pyparsing
easy_install pyparsing
wheel install pyparsing
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-2.1.8.zip
(1.4 MB
view details)
pyparsing-2.1.8.tar.gz
(1.2 MB
view details)
Built Distributions
pyparsing-2.1.8.win32-py3.5.exe
(515.6 kB
view details)
pyparsing-2.1.8.win32-py3.4.exe
(246.3 kB
view details)
pyparsing-2.1.8.win32-py3.3.exe
(246.3 kB
view details)
pyparsing-2.1.8.win32-py2.7.exe
(251.4 kB
view details)
pyparsing-2.1.8.win32-py2.6.exe
(251.4 kB
view details)
File details
Details for the file pyparsing-2.1.8.zip
.
File metadata
- Download URL: pyparsing-2.1.8.zip
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f1ea360086cd68681e7f4ca8f1f38df47bf81942a0d76a9673c2d23eff35b13 |
|
MD5 | 47342b0e7ab5c3a127d764a050f9bd1f |
|
BLAKE2b-256 | 8fad3dc140bbac31e144585035be42d65b2edb2d502af82c9a5284f7d2662bf7 |
File details
Details for the file pyparsing-2.1.8.tar.gz
.
File metadata
- Download URL: pyparsing-2.1.8.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03a4869b9f3493807ee1f1cb405e6d576a1a2ca4d81a982677c0c1ad6177c56b |
|
MD5 | 034b935c55b7fcace3c8b5031392cd70 |
|
BLAKE2b-256 | 65251bb68622ca70abc145ac9c9bcd0e837fccd2889d79cee641aa8604d18a11 |
File details
Details for the file pyparsing-2.1.8.win32-py3.5.exe
.
File metadata
- Download URL: pyparsing-2.1.8.win32-py3.5.exe
- Upload date:
- Size: 515.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 367b90cc877b46af56d4580cd0ae278062903f02b8204ab631f5a2c0f50adfd0 |
|
MD5 | 70b6b113a20618ca3606b1fbddf19a92 |
|
BLAKE2b-256 | e917436c1b8a8414d3350e32b504544af6ea1b2f61252b931971321b31922e1f |
File details
Details for the file pyparsing-2.1.8.win32-py3.4.exe
.
File metadata
- Download URL: pyparsing-2.1.8.win32-py3.4.exe
- Upload date:
- Size: 246.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3626b4d81cfb300dad57f52f2f791caaf7b06c09b368c0aa7b868e53a5775424 |
|
MD5 | cd009ef1bb7c091b3b303f85d8b5910b |
|
BLAKE2b-256 | 85a64700a3b54eca8edd686e0de8550af47cb30fde7575184a37454bae0fb3ee |
File details
Details for the file pyparsing-2.1.8.win32-py3.3.exe
.
File metadata
- Download URL: pyparsing-2.1.8.win32-py3.3.exe
- Upload date:
- Size: 246.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f463a6bcc4eeb6c08f1ed84439b17818e2085937c0dee0d7674ac127c67c12b |
|
MD5 | 6f2163dd44ea87f618fc7b90b9c13c6e |
|
BLAKE2b-256 | 97bc7c64187faf333260d6e7cdf5abfc17b0fec737a8961981da383112579ca7 |
File details
Details for the file pyparsing-2.1.8.win32-py2.7.exe
.
File metadata
- Download URL: pyparsing-2.1.8.win32-py2.7.exe
- Upload date:
- Size: 251.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e9a7f052f8e26bcf749e4033e3115b6dc7e3c85aafcb794b9a88c9d9ef13c97 |
|
MD5 | 37effeca4ae4484dfa7e54f3d81ec0c4 |
|
BLAKE2b-256 | 59ac11cd6c55bde0f3d6b722fb3e23a1ca401c4a050c2516fc915b9d0002627c |
File details
Details for the file pyparsing-2.1.8.win32-py2.6.exe
.
File metadata
- Download URL: pyparsing-2.1.8.win32-py2.6.exe
- Upload date:
- Size: 251.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab09aee814c0241ff0c503cff30018219fe1fc14501d89f406f4664a0ec9fbcd |
|
MD5 | 68caea6987c27d98247b37e3012a0c27 |
|
BLAKE2b-256 | a9af6e937172803b12d0b09cbd490a31efec72ee8d59f2fe55a953e319fe8f29 |
File details
Details for the file pyparsing-2.1.8-py2.py3-none-any.whl
.
File metadata
- Download URL: pyparsing-2.1.8-py2.py3-none-any.whl
- Upload date:
- Size: 54.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f0f5ceb14eccd5aef809d6382e87df22ca1da583c79f6db01675ce7d7f49c18 |
|
MD5 | 884c5ee902a1d39d6bd22cf2f0a2f0ed |
|
BLAKE2b-256 | 85b9188515f35f78533b3f82966a2c3f1a71a86df8b801367ee75a77191a861d |