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.3.2 or later.)
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.3.2 or later.)
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.3.zip
(1.6 MB
view details)
pyparsing-2.0.3.tar.gz
(1.5 MB
view details)
Built Distributions
pyparsing-2.0.3.win32-py3.4.exe
(232.7 kB
view details)
pyparsing-2.0.3.win32-py3.3.exe
(232.7 kB
view details)
pyparsing-2.0.3.win32-py3.2.exe
(232.7 kB
view details)
pyparsing-2.0.3.win32-py3.1.exe
(232.7 kB
view details)
pyparsing-2.0.3.win32-py3.0.exe
(232.7 kB
view details)
pyparsing-2.0.3.win32-py2.7.exe
(232.7 kB
view details)
pyparsing-2.0.3.win32-py2.6.exe
(232.7 kB
view details)
File details
Details for the file pyparsing-2.0.3.zip
.
File metadata
- Download URL: pyparsing-2.0.3.zip
- Upload date:
- Size: 1.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43d7710fdaa194a3bccf3127d06dec8e2de99a7efe6c47f01d4b748a1d04b192 |
|
MD5 | 0a5ec41bb650aed802751a311b5d820d |
|
BLAKE2b-256 | 522dad1c5c1919c22588da4dfad86489a03329b5359d8ab8ea6a543e27571e4e |
File details
Details for the file pyparsing-2.0.3.tar.gz
.
File metadata
- Download URL: pyparsing-2.0.3.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06e729e1cbf5274703b1f47b6135ed8335999d547f9d8cf048b210fb8ebf844f |
|
MD5 | 0fe479be09fc2cf005f753d3acc35939 |
|
BLAKE2b-256 | d2f960bebd372903c3ca2e9216086ac375d4991cce6261b186e6cf908ef5d49d |
File details
Details for the file pyparsing-2.0.3.win32-py3.4.exe
.
File metadata
- Download URL: pyparsing-2.0.3.win32-py3.4.exe
- Upload date:
- Size: 232.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbbb9311fff1bdc4b14fe6c775f2622e7dc2fc71cf4d5407d560f405b9e0d56d |
|
MD5 | d0b523329e37fe7caa87a1e6723e9aca |
|
BLAKE2b-256 | 05f9cd563f3190f228f3c615dc223fc1229506e8405102e9f7efb60f9103f3eb |
File details
Details for the file pyparsing-2.0.3.win32-py3.3.exe
.
File metadata
- Download URL: pyparsing-2.0.3.win32-py3.3.exe
- Upload date:
- Size: 232.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | edc1858f5987802156589738035428204069a14067d819de79387b1ca64e135d |
|
MD5 | 60fd563ef2833cea0c6b84160576336e |
|
BLAKE2b-256 | fe38221ddebf6c4ae77c4def2ad9b7a578f31be483559f317a90b1e6d65cc482 |
File details
Details for the file pyparsing-2.0.3.win32-py3.2.exe
.
File metadata
- Download URL: pyparsing-2.0.3.win32-py3.2.exe
- Upload date:
- Size: 232.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9948c6e024eecd2030b8d67b383621a17953df8d5611fdfecd744a4058896839 |
|
MD5 | cb12c00a14286528ef70245d126904bb |
|
BLAKE2b-256 | bf2f7d59c02c2f107baaaf17ab6812768aa716eed5911c11b382f6c8384493a9 |
File details
Details for the file pyparsing-2.0.3.win32-py3.1.exe
.
File metadata
- Download URL: pyparsing-2.0.3.win32-py3.1.exe
- Upload date:
- Size: 232.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a7790bbc9b44a141c002d69dd59953b4c3a5edba704440df4ea4154b7942435 |
|
MD5 | 1a207821d40dd21235d87397f2a151b3 |
|
BLAKE2b-256 | b62eb08f6418a325887a77d1df45c9efca62137415aeb8ed4f6ac36aac8884b6 |
File details
Details for the file pyparsing-2.0.3.win32-py3.0.exe
.
File metadata
- Download URL: pyparsing-2.0.3.win32-py3.0.exe
- Upload date:
- Size: 232.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34fb77861e357f7a925f5aafa7eefd16d46416652a978b88908a3930567aa80a |
|
MD5 | 7ffd9e477bdd2ceff0a9c9f48ac43d4c |
|
BLAKE2b-256 | 16ef8bda81ef8089bb4ae56f5ef4f526df242aed1a1a00b2bd1e9e47989ecc82 |
File details
Details for the file pyparsing-2.0.3.win32-py2.7.exe
.
File metadata
- Download URL: pyparsing-2.0.3.win32-py2.7.exe
- Upload date:
- Size: 232.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b8bda8b4c4a0cc4eb97a4c7a7a1f652c1ff83eb7bfe77670715ee942e3d24e6 |
|
MD5 | 1ca37c237b92ae033feec47cc00b7d14 |
|
BLAKE2b-256 | c9f04a06ad50583151e49da65121a506387df87f051915528ffee1137871d39f |
File details
Details for the file pyparsing-2.0.3.win32-py2.6.exe
.
File metadata
- Download URL: pyparsing-2.0.3.win32-py2.6.exe
- Upload date:
- Size: 232.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f9396b5a10f6cf0a7e2cedde20ca8d3af8a2a12943d9d27811aa58816ff90b8 |
|
MD5 | 5639878e51d3fe5bcaf9ee41f1c12e4e |
|
BLAKE2b-256 | d12d6bbe734d0bb2197dab33788aff2f3f60cc81f17372b6ffe8ecb48545c570 |
File details
Details for the file pyparsing-2.0.3-py2.py3-none-any.whl
.
File metadata
- Download URL: pyparsing-2.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 37.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9c896bab06dbf3759ad5fb63cfdb3777191e2c4ae640e6dd69ed37530f6ba56 |
|
MD5 | 4c16ef222caea2e5de741ae503aae652 |
|
BLAKE2b-256 | 8ff43a70b5e5b865b1ec45fe48dc5a57cd4facb5c7bd80e5cb1255c362732e81 |