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.0.zip
(1.3 MB
view details)
pyparsing-2.1.0.tar.gz
(1.1 MB
view details)
Built Distributions
pyparsing-2.1.0.win32-py3.5.exe
(235.8 kB
view details)
pyparsing-2.1.0.win32-py3.4.exe
(235.8 kB
view details)
pyparsing-2.1.0.win32-py3.3.exe
(235.8 kB
view details)
pyparsing-2.1.0.win32-py2.7.exe
(235.8 kB
view details)
pyparsing-2.1.0.win32-py2.6.exe
(105.3 kB
view details)
File details
Details for the file pyparsing-2.1.0.zip
.
File metadata
- Download URL: pyparsing-2.1.0.zip
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba274dd441b4ebbb684f1dda372664cc6af3201c717293b2cb7562627c13c802 |
|
MD5 | 4b77862e3ac5d1e40dc6cebce8a1afa2 |
|
BLAKE2b-256 | cc5c63058b8f3d0fb56b65fe8477a308bd69f079547cef12704e6be0171b93e8 |
File details
Details for the file pyparsing-2.1.0.tar.gz
.
File metadata
- Download URL: pyparsing-2.1.0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6cb2bc85a491347c3c699db47f7ecc02903959156b4f92669ebf82395982901 |
|
MD5 | 6fc363eb77331f9cf435d65f63f364ea |
|
BLAKE2b-256 | 3c49164a9d65e0b6ef182b328bcfdb35e2a7b978dd2a74602150ee16d7b0b251 |
File details
Details for the file pyparsing-2.1.0.win32-py3.5.exe
.
File metadata
- Download URL: pyparsing-2.1.0.win32-py3.5.exe
- Upload date:
- Size: 235.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 769f0d74ced4e8133a205fb24561d129c978217fa0c3a610a71fe0971dd6646e |
|
MD5 | 6cea83a19329ec278726f72742e09a08 |
|
BLAKE2b-256 | 1e2b97c0e3a03fe624ca673d2e1f0ca3370e68b7e7056d03f1c073cc8b613ce2 |
File details
Details for the file pyparsing-2.1.0.win32-py3.4.exe
.
File metadata
- Download URL: pyparsing-2.1.0.win32-py3.4.exe
- Upload date:
- Size: 235.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce13c622301acc0239b105e43ba2495e78665cbb13d4647dc74d10de6a5c7a69 |
|
MD5 | f3e8af83028de0d4649a9824ad96bf36 |
|
BLAKE2b-256 | 720fb0f059c50687778383130223a1bd8bb92504c4c08d4f48e4f08fadd8408f |
File details
Details for the file pyparsing-2.1.0.win32-py3.3.exe
.
File metadata
- Download URL: pyparsing-2.1.0.win32-py3.3.exe
- Upload date:
- Size: 235.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e06a750886e562dd2a0eba195ee79216c94fc74555d0fe4f94a473c915f44636 |
|
MD5 | 230881d07096e608e66c22fe0a0d5741 |
|
BLAKE2b-256 | e91d03adc07b5707bad13a5aa203ef96b4718c64d48cedcc6d356c4554a31b36 |
File details
Details for the file pyparsing-2.1.0.win32-py2.7.exe
.
File metadata
- Download URL: pyparsing-2.1.0.win32-py2.7.exe
- Upload date:
- Size: 235.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf1725d0de8adfa062215afe0edd2acd1097b489eef27616a43ea4c696746a13 |
|
MD5 | 0c762943e426bc556f76366d103e9316 |
|
BLAKE2b-256 | ee158bb8c33f8bcc2d0950d099ff62c742f93e31fe79411c11d15eee78d7c460 |
File details
Details for the file pyparsing-2.1.0.win32-py2.6.exe
.
File metadata
- Download URL: pyparsing-2.1.0.win32-py2.6.exe
- Upload date:
- Size: 105.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c100cded2aa93b7d0629934c4b671ae3b4e192e88546686cf6bd54255de7bc6 |
|
MD5 | bac6d98ff9954602a21269dc3341a3f2 |
|
BLAKE2b-256 | c93839878b4ed9b4104750bb7e48099c597c0668c83811020a8e991e4d93b781 |
File details
Details for the file pyparsing-2.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pyparsing-2.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 39.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33b8b9da9989456fb92aeb5ae96c28d74cc8f1b14b42d62b2508174afb155787 |
|
MD5 | 1684c60ad8657cd5d8e8260891f6ef7d |
|
BLAKE2b-256 | ed4022d4029d6c7b5eb27038ae1ca2ab27a3ff22d88f6577a2f1d9ef609f6447 |