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.0.7.zip
(1.3 MB
view details)
pyparsing-2.0.7.tar.gz
(1.1 MB
view details)
Built Distributions
pyparsing-2.0.7.win32-py3.5.exe
(235.2 kB
view details)
pyparsing-2.0.7.win32-py3.4.exe
(235.2 kB
view details)
pyparsing-2.0.7.win32-py3.3.exe
(235.2 kB
view details)
pyparsing-2.0.7.win32-py3.2.exe
(235.2 kB
view details)
pyparsing-2.0.7.win32-py2.7.exe
(235.2 kB
view details)
pyparsing-2.0.7.win32-py2.6.exe
(104.6 kB
view details)
File details
Details for the file pyparsing-2.0.7.zip
.
File metadata
- Download URL: pyparsing-2.0.7.zip
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e08c1444c91e194bd17ffdaefce7edb5a6036e57f2bb7df5b6c7776d86f4134 |
|
MD5 | 1326214959b2e039427cfc27baf846fa |
|
BLAKE2b-256 | 7ef5941ce83056de4ded5044e26bf09dab35ab7c4895097e1fde143c2be6b8ed |
File details
Details for the file pyparsing-2.0.7.tar.gz
.
File metadata
- Download URL: pyparsing-2.0.7.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ce0db3c70ec0413603d4aea389e4ece34ff93c265649b1c5c7d56e3c2cf19c4 |
|
MD5 | 1c8bed7530642ca19197f3caa05fd28b |
|
BLAKE2b-256 | 30b612a3f337bf6eb3d681f4f83d6c8da596f99c6ce44797aa91869c1f103729 |
File details
Details for the file pyparsing-2.0.7.win32-py3.5.exe
.
File metadata
- Download URL: pyparsing-2.0.7.win32-py3.5.exe
- Upload date:
- Size: 235.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9043b3c6b0722ec8d47b853768c500ca5246ef1ecd4f9d132a43452c7d3d4588 |
|
MD5 | 4b7927fc98a782fd92c2f9a4c79aa238 |
|
BLAKE2b-256 | 4959d06692e83ccdee28aa81e58f30498a195a830a935604a7195f4f65575edc |
File details
Details for the file pyparsing-2.0.7.win32-py3.4.exe
.
File metadata
- Download URL: pyparsing-2.0.7.win32-py3.4.exe
- Upload date:
- Size: 235.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a03b4e7ea18538064b5e1be4a66cdef35370a4e76dd10574ca35c386dbeca560 |
|
MD5 | 32670e97b78f03819d8af9d5ae8a2a8a |
|
BLAKE2b-256 | f94e2c2d59d2ce9b2b182f534526ea1d3a08f7213c4d0fb010b7b05dcd180312 |
File details
Details for the file pyparsing-2.0.7.win32-py3.3.exe
.
File metadata
- Download URL: pyparsing-2.0.7.win32-py3.3.exe
- Upload date:
- Size: 235.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fa0713063d809d00db2123431a8d603474a62232491e0455cd13761e8fec655 |
|
MD5 | 90eba5c44874f1c498d3c6156250beb2 |
|
BLAKE2b-256 | 29bb6176dda13bc48dcb6b5956a5d1869670d8cb665da2cc78ef9a933525bc66 |
File details
Details for the file pyparsing-2.0.7.win32-py3.2.exe
.
File metadata
- Download URL: pyparsing-2.0.7.win32-py3.2.exe
- Upload date:
- Size: 235.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e194341721f6d5516cfec0d8d99dad6c584373323b6694f8c2f089a00273c07 |
|
MD5 | 3208020198d817df82dbf83bae0893c8 |
|
BLAKE2b-256 | c7f08c42519449d505e891f408e60fd7472f710d8bef4837a8d31a588c23920d |
File details
Details for the file pyparsing-2.0.7.win32-py2.7.exe
.
File metadata
- Download URL: pyparsing-2.0.7.win32-py2.7.exe
- Upload date:
- Size: 235.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b58b7d993956dab2efa41ee9424700b4c630fcbd85c41531211d36fbbd6e0592 |
|
MD5 | d1f6de634643406f7dada60f9aedfde2 |
|
BLAKE2b-256 | b578f59dfe936aa0dbff1356179ea9a05a9bf69130ac17679936391ea08ffdbe |
File details
Details for the file pyparsing-2.0.7.win32-py2.6.exe
.
File metadata
- Download URL: pyparsing-2.0.7.win32-py2.6.exe
- Upload date:
- Size: 104.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3470388781fb94eccf75141b0b65490637e2717f983a719011e1aa156eec3d7e |
|
MD5 | c03e12050e1ca1008781123d6390ea65 |
|
BLAKE2b-256 | 16987508fff57563ca42a6c096cfe119560f3906872e509711e7e87e70527abf |
File details
Details for the file pyparsing-2.0.7-py2.py3-none-any.whl
.
File metadata
- Download URL: pyparsing-2.0.7-py2.py3-none-any.whl
- Upload date:
- Size: 38.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56adc21a4b86391db146b7f74f8c789c396401915703bbd19b793e2a7c30bb46 |
|
MD5 | 7c5f691a0db36f1fc7dda5c084028ffb |
|
BLAKE2b-256 | acde44b122749e143cf87db83edb2d3d239da772e1c3ae4cbeb55964a1bfabdd |