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.6.zip
(1.4 MB
view details)
pyparsing-2.1.6.tar.gz
(1.2 MB
view details)
Built Distributions
pyparsing-2.1.6.win32-py3.5.exe
(514.8 kB
view details)
pyparsing-2.1.6.win32-py3.4.exe
(245.5 kB
view details)
pyparsing-2.1.6.win32-py3.3.exe
(245.5 kB
view details)
pyparsing-2.1.6.win32-py2.7.exe
(250.7 kB
view details)
pyparsing-2.1.6.win32-py2.6.exe
(250.7 kB
view details)
File details
Details for the file pyparsing-2.1.6.zip
.
File metadata
- Download URL: pyparsing-2.1.6.zip
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10edd0cc2d1dd275bff4ce9bd852b8dcfb6f3b25eafff6e4e0d7e3dd06ffb67b |
|
MD5 | 788feab4ca221f0655c382f9684df5aa |
|
BLAKE2b-256 | cb646f82f2b126cdf7e4d081f3a025ba216b048bc13fa060e8c78ad2556eefc5 |
File details
Details for the file pyparsing-2.1.6.tar.gz
.
File metadata
- Download URL: pyparsing-2.1.6.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bbdeb6ba83077136cebf642fb0ac526a4230f72944e7f6a240df2fdd83c6e66 |
|
MD5 | b90c23e9e2ae57d6b910768d2af71941 |
|
BLAKE2b-256 | e885de26a00e3dc11062bd0794a365993c0e67550875592c86faad9802c05b83 |
File details
Details for the file pyparsing-2.1.6.win32-py3.5.exe
.
File metadata
- Download URL: pyparsing-2.1.6.win32-py3.5.exe
- Upload date:
- Size: 514.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b333729b0af946c804e6fa92f4d195669e773714acfc82270490a706a0a67908 |
|
MD5 | 0f2fc25e1f7eefc10a0363066899f678 |
|
BLAKE2b-256 | f706f18c830c4ea41eb020c5496e6942fd49e65678d4c5dc70ba0d0f50764605 |
File details
Details for the file pyparsing-2.1.6.win32-py3.4.exe
.
File metadata
- Download URL: pyparsing-2.1.6.win32-py3.4.exe
- Upload date:
- Size: 245.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71c1b68be6673cde83dc51a7eb689119b2d48fbfa07f281de3987f54c332a400 |
|
MD5 | 58c6b3bfaa51fdea2df72638089bfda4 |
|
BLAKE2b-256 | 0eb21c51c02cbe7f158b038e51f114aac2c093143838e7ed3c12ab0c1b06c8f5 |
File details
Details for the file pyparsing-2.1.6.win32-py3.3.exe
.
File metadata
- Download URL: pyparsing-2.1.6.win32-py3.3.exe
- Upload date:
- Size: 245.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b19719a54e8739018b3fbd76817b37e6b989398b37e237f26ed5fe9805cd1bb |
|
MD5 | e593a38b20cc5a78dd5f0da64749dc61 |
|
BLAKE2b-256 | a8abc1309c9ec63f9115876cca63514546ad450fe6c2747fbe3e7deea53bf766 |
File details
Details for the file pyparsing-2.1.6.win32-py2.7.exe
.
File metadata
- Download URL: pyparsing-2.1.6.win32-py2.7.exe
- Upload date:
- Size: 250.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ee62fd9d796c9e289c0856b14189e01291c9a6c52070c13daa788b66196794d |
|
MD5 | e49df89dfbf6d236684f2300c3179190 |
|
BLAKE2b-256 | 276153cfaa174b6f80b51e4d1dcdfb97fdf8cb77b8e055fe9c19a4740d86823f |
File details
Details for the file pyparsing-2.1.6.win32-py2.6.exe
.
File metadata
- Download URL: pyparsing-2.1.6.win32-py2.6.exe
- Upload date:
- Size: 250.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d6a365d01510b59e21b85f00d0f66a722cd6399888d5818beaafc7ee3d886f8 |
|
MD5 | 96a8a46ca0068c5a50932d3cbe0cdd12 |
|
BLAKE2b-256 | ecd1c055408d6a9c51402e73b3c248feb889aa52d224cdef990ea258d21b5840 |
File details
Details for the file pyparsing-2.1.6-py2.py3-none-any.whl
.
File metadata
- Download URL: pyparsing-2.1.6-py2.py3-none-any.whl
- Upload date:
- Size: 53.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5534719f4abaac4efd93c295f9aad9d10f516dd7d1a5cf7f0af7eed5fdad9524 |
|
MD5 | 2a6dc670b145f08e3f89cf3fda87dfc6 |
|
BLAKE2b-256 | 82e244fd113b9be057848a30cba3ed238a534814b5266ffc9402605f3a1707ca |