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.9.zip
(1.4 MB
view details)
pyparsing-2.1.9.tar.gz
(1.2 MB
view details)
Built Distributions
pyparsing-2.1.9.win32-py3.5.exe
(516.9 kB
view details)
pyparsing-2.1.9.win32-py3.4.exe
(247.6 kB
view details)
pyparsing-2.1.9.win32-py3.3.exe
(247.6 kB
view details)
pyparsing-2.1.9.win32-py2.7.exe
(252.7 kB
view details)
pyparsing-2.1.9.win32-py2.6.exe
(252.7 kB
view details)
File details
Details for the file pyparsing-2.1.9.zip
.
File metadata
- Download URL: pyparsing-2.1.9.zip
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91f9c01432128b70369c574c219cc3d144d05274c0deb9b70bf8385c264d1daf |
|
MD5 | 1c6acfca7c0c0f28113b3de1d4239e12 |
|
BLAKE2b-256 | 289eee6dcf7883b2b74e9369b1c72a1ea4a72f6e82a401072902d79a44d80e35 |
File details
Details for the file pyparsing-2.1.9.tar.gz
.
File metadata
- Download URL: pyparsing-2.1.9.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93326f5490bcfe7069806ff342692e75f72529cfa82f20683b5fceeb5d4a7fc2 |
|
MD5 | ee943c354eac79526533c58342f322c7 |
|
BLAKE2b-256 | 87ee6f3a94d834c82a5c1a74f2fc77775ff05b5fbbf7d97f844e6fff5e2ff94b |
File details
Details for the file pyparsing-2.1.9.win32-py3.5.exe
.
File metadata
- Download URL: pyparsing-2.1.9.win32-py3.5.exe
- Upload date:
- Size: 516.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 677f11fc45ef67ce8a77ee7b61c4fd615e0bacb7fd478ce9fa7a5768513b94e2 |
|
MD5 | d9068d4beae74328e70a994a44659526 |
|
BLAKE2b-256 | c6217efa88b66fff487146926011f799cb128465dccafd69b333192d098df9d7 |
File details
Details for the file pyparsing-2.1.9.win32-py3.4.exe
.
File metadata
- Download URL: pyparsing-2.1.9.win32-py3.4.exe
- Upload date:
- Size: 247.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 693b56bc4695806b3b33f1e3b2f2bf10ff9248924050331c9b6f6f5242d091a5 |
|
MD5 | fb87ba59123e1e34d2bda703941fe5aa |
|
BLAKE2b-256 | 04d99f7f721e7bb91afd179e24b1a90530c868aa999bd442465b344b3b2f6f49 |
File details
Details for the file pyparsing-2.1.9.win32-py3.3.exe
.
File metadata
- Download URL: pyparsing-2.1.9.win32-py3.3.exe
- Upload date:
- Size: 247.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dde8f8424e8f77c382406f6c92a8577bb70976cf0156b69fdc8b1ae59335a0f |
|
MD5 | aa778bbab881e533ffa3979fc99195c1 |
|
BLAKE2b-256 | a774397ddd944ddd7ea89c0b6ad3ca973b1b6a3fac5032d187d8c9fbfe559273 |
File details
Details for the file pyparsing-2.1.9.win32-py2.7.exe
.
File metadata
- Download URL: pyparsing-2.1.9.win32-py2.7.exe
- Upload date:
- Size: 252.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e2cf4dc13ce854d9c322d1c2333ce377dccb7e731c09c908c608f6078b26e4b |
|
MD5 | 2369405b8b8ff30853380f198659749a |
|
BLAKE2b-256 | 39d05cc8f88963fe9dad613a9c964c4b427abf6995a74fb8e18c5f223cb3023a |
File details
Details for the file pyparsing-2.1.9.win32-py2.6.exe
.
File metadata
- Download URL: pyparsing-2.1.9.win32-py2.6.exe
- Upload date:
- Size: 252.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df715b2feecd6057a6d727a014a5abcceeac96870e3f5ef0b3b75bd3e0d24971 |
|
MD5 | 2b5f92dc4e3df8d18a9e54ad76ec7d1a |
|
BLAKE2b-256 | 995f57d9c50a56ec2c3cccdda277b07e7bea7574b959876abb44f0d83ddb2552 |
File details
Details for the file pyparsing-2.1.9-py2.py3-none-any.whl
.
File metadata
- Download URL: pyparsing-2.1.9-py2.py3-none-any.whl
- Upload date:
- Size: 55.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52027939e7a7990ca83b6bab549d94e298990b27b3308a382099df908abd8748 |
|
MD5 | 2fd0cc352d21c7020028c1952116d75b |
|
BLAKE2b-256 | 40f8926538c3f358a52ea5fd61bfe78f9c208bfd5ebc152d148503e210f23ed2 |