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.5.zip
(1.3 MB
view details)
pyparsing-2.1.5.tar.gz
(1.2 MB
view details)
Built Distributions
pyparsing-2.1.5.win32-py3.5.exe
(239.4 kB
view details)
pyparsing-2.1.5.win32-py3.4.exe
(239.4 kB
view details)
pyparsing-2.1.5.win32-py3.3.exe
(239.4 kB
view details)
pyparsing-2.1.5.win32-py2.7.exe
(239.4 kB
view details)
pyparsing-2.1.5.win32-py2.6.exe
(108.9 kB
view details)
File details
Details for the file pyparsing-2.1.5.zip
.
File metadata
- Download URL: pyparsing-2.1.5.zip
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7d36c1bd9c54e98fd8850da5a9ab43359dfb84ba717ee26768e9c4f81288a1c |
|
MD5 | 2a94424d19e96e19aca9f78b198f9070 |
|
BLAKE2b-256 | 9e37171c883978003807369e3a5fadd621766a48eb3889032af6ad620a229b37 |
File details
Details for the file pyparsing-2.1.5.tar.gz
.
File metadata
- Download URL: pyparsing-2.1.5.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9ace99b581174d7ca98891a7bc57fd08892b94f17922645d90835f7b9b54a56 |
|
MD5 | 28d0c3cf39ee5859d408d2b4d311a9c2 |
|
BLAKE2b-256 | 30c3a424fb888af373b54df495a0582379df374322caabd4f3a549bcca72aeeb |
File details
Details for the file pyparsing-2.1.5.win32-py3.5.exe
.
File metadata
- Download URL: pyparsing-2.1.5.win32-py3.5.exe
- Upload date:
- Size: 239.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1da088e9cfd55d06d5789ea6578add13aedf1eaf33255ab89c9961ae013564eb |
|
MD5 | 153e7f544c2478abfaa1a088cc576186 |
|
BLAKE2b-256 | aefebdb61cc307385eae2427eaef1e70a03cc872eb2876841ea8b3e452e4083e |
File details
Details for the file pyparsing-2.1.5.win32-py3.4.exe
.
File metadata
- Download URL: pyparsing-2.1.5.win32-py3.4.exe
- Upload date:
- Size: 239.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13a0ae1d2491a6e4a426383c8e4bc32d91db2b55b00e0d54642300a50c6130e1 |
|
MD5 | 2a901fe884c9f0866403d1065d7b567f |
|
BLAKE2b-256 | 547042233b4ed2a5e4fb308a5198ffe73c2af9f683b258cdcd1e98b80f67a700 |
File details
Details for the file pyparsing-2.1.5.win32-py3.3.exe
.
File metadata
- Download URL: pyparsing-2.1.5.win32-py3.3.exe
- Upload date:
- Size: 239.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52d10cf88c6f05135895dbba7937f1aae13a41ea865b5716fab61f535a305b36 |
|
MD5 | 23e600c9b55427a9c27d703e5d9b8d24 |
|
BLAKE2b-256 | 9bdc5408a1327c928a82438d55d0279824bc89b7e55818ef02412d25a99a6d8a |
File details
Details for the file pyparsing-2.1.5.win32-py2.7.exe
.
File metadata
- Download URL: pyparsing-2.1.5.win32-py2.7.exe
- Upload date:
- Size: 239.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49fef68224ab25fea6b6a5c0e7a6a14695dabc1e5d48de829cb477a2a35e870c |
|
MD5 | 91d885296ca6c006503e989b23a29846 |
|
BLAKE2b-256 | e22a3c61e2a1d41c69ec42c5e22414217bfea57cfdb796b2eaca4b5c24d72f31 |
File details
Details for the file pyparsing-2.1.5.win32-py2.6.exe
.
File metadata
- Download URL: pyparsing-2.1.5.win32-py2.6.exe
- Upload date:
- Size: 108.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36e5e349de0ce2821f3f7c9e054c2e2dce54e075d62ec05acd893ed398a5ea76 |
|
MD5 | ebff0024ffeba0b9c1655224f1d8a9c4 |
|
BLAKE2b-256 | 9203ccb2d7f386d9f6c4b7c843554f65d03a1e0d0583ba04085efa1e375a76d5 |
File details
Details for the file pyparsing-2.1.5-py2.py3-none-any.whl
.
File metadata
- Download URL: pyparsing-2.1.5-py2.py3-none-any.whl
- Upload date:
- Size: 42.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d91797f369fc2f11bbcfcc4234bca1b1ff114bdb3557a14458f1bd35211916e5 |
|
MD5 | 86cc5bebed5f1c0b5c9900f7cf1a9e4f |
|
BLAKE2b-256 | 24c53ce00e6a5fca0eb962553467a51b44de1a13e1bc23dabf58e2e9799b8807 |