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.4.zip
(1.3 MB
view details)
pyparsing-2.1.4.tar.gz
(1.2 MB
view details)
Built Distributions
pyparsing-2.1.4.win32-py3.5.exe
(237.6 kB
view details)
pyparsing-2.1.4.win32-py3.4.exe
(237.6 kB
view details)
pyparsing-2.1.4.win32-py3.3.exe
(237.6 kB
view details)
pyparsing-2.1.4.win32-py2.7.exe
(237.6 kB
view details)
pyparsing-2.1.4.win32-py2.6.exe
(107.0 kB
view details)
File details
Details for the file pyparsing-2.1.4.zip
.
File metadata
- Download URL: pyparsing-2.1.4.zip
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54f1cafe211c653735df3a25f81ea04b52fa73da6276687a378ada11ddf84a78 |
|
MD5 | dd4450928cd2e718133271e7feb34442 |
|
BLAKE2b-256 | 3bbdc1012598867074abf91793a00a1fa6913ebf7bd319bc3524993de0894eeb |
File details
Details for the file pyparsing-2.1.4.tar.gz
.
File metadata
- Download URL: pyparsing-2.1.4.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9234dea79b50d49b92a994132cd1c84e873f3936db94977a66f0a4159b1797c |
|
MD5 | 322059c57f0c9f11da1c6c06a2ba2197 |
|
BLAKE2b-256 | ae0cb6ce7eea7ccf020ae68db1119bacaa07ad91fedaefaf8f3265e8dd156813 |
File details
Details for the file pyparsing-2.1.4.win32-py3.5.exe
.
File metadata
- Download URL: pyparsing-2.1.4.win32-py3.5.exe
- Upload date:
- Size: 237.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28bc70dbe824360d1b11862c2c8aab63d6713f2b259282ef0eb0f081db35bc8a |
|
MD5 | 08101f5a74c90dea9957004d79fc0a25 |
|
BLAKE2b-256 | 7c39b2f62e688d70de0552f73a1a31aff77bb3c9e23f58811f9c54c0a26a69a6 |
File details
Details for the file pyparsing-2.1.4.win32-py3.4.exe
.
File metadata
- Download URL: pyparsing-2.1.4.win32-py3.4.exe
- Upload date:
- Size: 237.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d0b5e479ed696d54cacfe6ee7a5ec927fdbfedc16141f60fe2bad62a3dbf934 |
|
MD5 | d9c12a8183a4c35bc8105f546bdad85c |
|
BLAKE2b-256 | 2564e853b8090f5444aebbe2a984ba6aeb69a835eb36a989cdc1f1b974ffd722 |
File details
Details for the file pyparsing-2.1.4.win32-py3.3.exe
.
File metadata
- Download URL: pyparsing-2.1.4.win32-py3.3.exe
- Upload date:
- Size: 237.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7800f53b30056d1a386d30c6e622bed7b947c76d44f81d541ca12563b1536e3 |
|
MD5 | 4ef6ca89d0f04285d0bea322d38c0442 |
|
BLAKE2b-256 | 8c52d6fc36481d3c7436be82b93f83b17001949780dc6791d4a2add6410ee81c |
File details
Details for the file pyparsing-2.1.4.win32-py2.7.exe
.
File metadata
- Download URL: pyparsing-2.1.4.win32-py2.7.exe
- Upload date:
- Size: 237.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae202972009530278d3b2fb3488c4d370340183c3438cfd005480e8d469dfb05 |
|
MD5 | e72f73d972919b826f06983d19abcc9d |
|
BLAKE2b-256 | db58d9417e60b911db2e1aea90290003d9a5621819b03c35c9e72f64df714f52 |
File details
Details for the file pyparsing-2.1.4.win32-py2.6.exe
.
File metadata
- Download URL: pyparsing-2.1.4.win32-py2.6.exe
- Upload date:
- Size: 107.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3079c49e9c320f6d1f8a0b15a89e84e8d672165ab5bb264a03d87ff12bd19e9 |
|
MD5 | 497d6067707905b42c5410fc2a1eac9e |
|
BLAKE2b-256 | 401a7627202681f7fddb687450adf4155212ef3c93ce6604752848480714d0cd |
File details
Details for the file pyparsing-2.1.4-py2.py3-none-any.whl
.
File metadata
- Download URL: pyparsing-2.1.4-py2.py3-none-any.whl
- Upload date:
- Size: 40.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ede41fb90c285a5159372e7de61d2f2451060cb38fa804a4ab53e3bcb2e61b6 |
|
MD5 | e2dde266aa7707415c10272cdaf63490 |
|
BLAKE2b-256 | 474964007b0bc2badabb6521f73939a7611d0620e6d335a9dd5c20e127aea267 |