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.1.zip
(1.3 MB
view details)
pyparsing-2.1.1.tar.gz
(1.1 MB
view details)
Built Distributions
pyparsing-2.1.1.win32-py3.5.exe
(235.7 kB
view details)
pyparsing-2.1.1.win32-py3.4.exe
(235.7 kB
view details)
pyparsing-2.1.1.win32-py3.3.exe
(235.7 kB
view details)
pyparsing-2.1.1.win32-py2.7.exe
(235.7 kB
view details)
pyparsing-2.1.1.win32-py2.6.exe
(105.2 kB
view details)
File details
Details for the file pyparsing-2.1.1.zip
.
File metadata
- Download URL: pyparsing-2.1.1.zip
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bd04badfda39b1e2fd0d77cb78b488c881d88c31734791a0ae902979ae10575 |
|
MD5 | 2a1d3a63ddc2ec9a3da961d1b7f258b2 |
|
BLAKE2b-256 | 549711c0b807bafeaf19f50efadb9bd9e47a5f397509154833a1bd66fee59f6a |
File details
Details for the file pyparsing-2.1.1.tar.gz
.
File metadata
- Download URL: pyparsing-2.1.1.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bae5cd4cbee6da0d7d8d9a1647f5253a3b89652e707647eaf1961f4932ae6c6 |
|
MD5 | 5ce9096d94f553e2bc1fd366fba65558 |
|
BLAKE2b-256 | 94513dd26b41be55ed05e72d1da87e4a732d8b92245b1f2f7fe2fa65a4910858 |
File details
Details for the file pyparsing-2.1.1.win32-py3.5.exe
.
File metadata
- Download URL: pyparsing-2.1.1.win32-py3.5.exe
- Upload date:
- Size: 235.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 900351d66d07f1338942074a4306c54d684d53a19df286e8679fdb69a0122dca |
|
MD5 | 7add8b376f53cdd46b47a5266a67f6ff |
|
BLAKE2b-256 | 32dda3274d5a0804bb543284080ee6547f32d8b78cf0557bac8a00a8216ad394 |
File details
Details for the file pyparsing-2.1.1.win32-py3.4.exe
.
File metadata
- Download URL: pyparsing-2.1.1.win32-py3.4.exe
- Upload date:
- Size: 235.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26d293069c5208e132bdeef81d4f9e20dd0d35da2ed78eded4af1da148fdf130 |
|
MD5 | c0fe8d3c5dccb896c2e2b27fe423dd91 |
|
BLAKE2b-256 | 36a91a10ee31e90acf9f4034b04b613a399c8181090b76e1d5a5c1a138061fa1 |
File details
Details for the file pyparsing-2.1.1.win32-py3.3.exe
.
File metadata
- Download URL: pyparsing-2.1.1.win32-py3.3.exe
- Upload date:
- Size: 235.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be0d5736784b6100bf47a587b112e9a5b00d0803025407feb981836109c1acb8 |
|
MD5 | abe98b7385d56b4bf1b98b4838d8c811 |
|
BLAKE2b-256 | 6c24b46d9827f53349f42aed67798b95a805bf1f0da665f9073bbf1f2b96dcfb |
File details
Details for the file pyparsing-2.1.1.win32-py2.7.exe
.
File metadata
- Download URL: pyparsing-2.1.1.win32-py2.7.exe
- Upload date:
- Size: 235.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1302197acc1d5bbb206ca35dfae346cbb16d493e08d720ee4b15e97665d82026 |
|
MD5 | 7cb342d42aeef18250e82145083aa53b |
|
BLAKE2b-256 | a5ea01209617d3fa09f9b80fdcd6fa9924f729d84f574d2cda3de2483d293a3e |
File details
Details for the file pyparsing-2.1.1.win32-py2.6.exe
.
File metadata
- Download URL: pyparsing-2.1.1.win32-py2.6.exe
- Upload date:
- Size: 105.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1a56b9e7c6a43ffe9a696cf3454b2c5774342d8493635da03d056d393591779 |
|
MD5 | f44a74ae169c6a427489147bb3f17fa7 |
|
BLAKE2b-256 | 44c8cb9cff22ff3738c13cfe38b6d14d2f46813246c9fc95d0ef9c708d7b9ac2 |
File details
Details for the file pyparsing-2.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: pyparsing-2.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 38.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a9743e0cba1df5ad7e5412d19a5ec1cd320c08852d5b5a4050aabe877d46c1f |
|
MD5 | 37807c1844f67ab795a9e4a172eec973 |
|
BLAKE2b-256 | 77e0a9ec2ed6e31b123e7babc788806cbd734775a3e4be9fac8f4cbf0b1f4356 |