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.5.zip
(1.3 MB
view details)
pyparsing-2.0.5.tar.gz
(1.1 MB
view details)
Built Distributions
pyparsing-2.0.5.win32-py3.5.exe
(235.0 kB
view details)
pyparsing-2.0.5.win32-py3.4.exe
(235.0 kB
view details)
pyparsing-2.0.5.win32-py3.3.exe
(235.0 kB
view details)
pyparsing-2.0.5.win32-py2.7.exe
(235.0 kB
view details)
pyparsing-2.0.5.win32-py2.6.exe
(104.5 kB
view details)
File details
Details for the file pyparsing-2.0.5.zip
.
File metadata
- Download URL: pyparsing-2.0.5.zip
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1b439e5dd08abb7bd2d4fb8a720ea96fe78803edcbfc3e7207c672285767bfa |
|
MD5 | 68df9a28b8e100c75b2dcb85e3db8b87 |
|
BLAKE2b-256 | f4b3522c4f0a103a4e48b821b89ce67564b405d83a4b234c316fca007c1d52bc |
File details
Details for the file pyparsing-2.0.5.tar.gz
.
File metadata
- Download URL: pyparsing-2.0.5.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58756bf33e989d84ac72142e4ca558cf10c778a3233edb0a86632f271409ba9e |
|
MD5 | ec7a522dd8ae22ddeb7c6f1aa95b72bb |
|
BLAKE2b-256 | 3a34f79db816d4d7506786fe4a7c804e11e39225e8b8f93a58e406edaa70e936 |
File details
Details for the file pyparsing-2.0.5.win32-py3.5.exe
.
File metadata
- Download URL: pyparsing-2.0.5.win32-py3.5.exe
- Upload date:
- Size: 235.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4d442cc65fbdac92c4cd68beaa184decde762927d5f3b7646a579b5fd49acfb |
|
MD5 | 04f5d1ad24b38f2ecd6b122cdc1b0124 |
|
BLAKE2b-256 | 55101779c99c4ea99bc55add8dd4dba26ac4a7b6889bc6506f2d4dd3669cb1d7 |
File details
Details for the file pyparsing-2.0.5.win32-py3.4.exe
.
File metadata
- Download URL: pyparsing-2.0.5.win32-py3.4.exe
- Upload date:
- Size: 235.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 372adfc0c6b4e72fde281f71368f251fe131d4a194db5eb53d8b4cb570168713 |
|
MD5 | 67f77775c5d2c7b09bc04086baf321d2 |
|
BLAKE2b-256 | baf22d5f00b5a4ee6334a39d80c946f5208922013a39c9876f3b84f18d5f14e9 |
File details
Details for the file pyparsing-2.0.5.win32-py3.3.exe
.
File metadata
- Download URL: pyparsing-2.0.5.win32-py3.3.exe
- Upload date:
- Size: 235.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e179886ba1fea06cb52e7684a512feab5739d5d80709c7ac4988cb4b53a8adc |
|
MD5 | 05feefa45b2ba8385041b91e34254eea |
|
BLAKE2b-256 | e4ae66f7bc7f71bbec526e10ba8d30fa9fc4f7369f3d281c4d5e8f1cfd0511f1 |
File details
Details for the file pyparsing-2.0.5.win32-py2.7.exe
.
File metadata
- Download URL: pyparsing-2.0.5.win32-py2.7.exe
- Upload date:
- Size: 235.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a74f9a7d9ee6451f4bf26953ae189c50e42bf35f9adf2527fc0660211d6c1d1a |
|
MD5 | eff2c1df5712396c914f26dc577243b4 |
|
BLAKE2b-256 | 1998b54fad3088089ed5aba8c86f51c623f9bd279d3c7cdb8369ab80ef1eee39 |
File details
Details for the file pyparsing-2.0.5.win32-py2.6.exe
.
File metadata
- Download URL: pyparsing-2.0.5.win32-py2.6.exe
- Upload date:
- Size: 104.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a99bdbcac07f49dca80eb05fac9f03e9a8151a84123605df4d2fce983d46256 |
|
MD5 | 69c539c80536eef13786ea00f12868d9 |
|
BLAKE2b-256 | cbf46f41ac39cbd9b65c81a257d6978dde8638a897b68a0662160a906077b099 |
File details
Details for the file pyparsing-2.0.5-py2.py3-none-any.whl
.
File metadata
- Download URL: pyparsing-2.0.5-py2.py3-none-any.whl
- Upload date:
- Size: 38.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29cfa7c2c22ece030a7da3181542e099355b59d8be34c6d6f9ae87766e369615 |
|
MD5 | 47b42476d9b89834bd7ebd5ab305cae1 |
|
BLAKE2b-256 | 2b25398db7ce5e2118af11f352e652569ecb76005f545e3a81b5c55cf8239913 |