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.2.zip
(1.3 MB
view details)
pyparsing-2.1.2.tar.gz
(1.1 MB
view details)
Built Distributions
pyparsing-2.1.2.win32-py3.5.exe
(236.0 kB
view details)
pyparsing-2.1.2.win32-py3.4.exe
(236.0 kB
view details)
pyparsing-2.1.2.win32-py3.3.exe
(236.0 kB
view details)
pyparsing-2.1.2.win32-py2.7.exe
(236.0 kB
view details)
pyparsing-2.1.2.win32-py2.6.exe
(105.5 kB
view details)
File details
Details for the file pyparsing-2.1.2.zip
.
File metadata
- Download URL: pyparsing-2.1.2.zip
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf5f46861ee6aedc949166b325d057d9ef1f420a7dd3c77841dbfa52d9f74588 |
|
MD5 | 3ebe0138a07d43eded7448388808730b |
|
BLAKE2b-256 | 90f58ca95e67983119f06326073e7ca3f0ce4325866a1358fab449a8f695dd52 |
File details
Details for the file pyparsing-2.1.2.tar.gz
.
File metadata
- Download URL: pyparsing-2.1.2.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57754e38d618fb47fdd17d1ce7a2dc8cbb7986ab07363ce8dcfc57270e6c9a2a |
|
MD5 | 1b5995b12fc17387bc4315559a1f13ee |
|
BLAKE2b-256 | 41451f1b5e0f58d9f5c4e60ca062704c033700d866958f5dc02531996239f5da |
File details
Details for the file pyparsing-2.1.2.win32-py3.5.exe
.
File metadata
- Download URL: pyparsing-2.1.2.win32-py3.5.exe
- Upload date:
- Size: 236.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b50e0dd96ff66158da6483bb3c917600ec7fc61a619d78a5dc8f30b9bfbbc4b |
|
MD5 | 06efa316ddfe67384c8abca8ec937efd |
|
BLAKE2b-256 | 847541e146cad97a998699675d1987285016681d8485423a0786ffaf4862bd29 |
File details
Details for the file pyparsing-2.1.2.win32-py3.4.exe
.
File metadata
- Download URL: pyparsing-2.1.2.win32-py3.4.exe
- Upload date:
- Size: 236.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16e943d8d435f2ad63e4deef935d9b733b47b6a27f9da50acd5684aba3690899 |
|
MD5 | 45f4084bcbeeea53c61a036bee24caaf |
|
BLAKE2b-256 | 14d0ee30aa21025d01c339baec2f4b6790a6a68023e2c05c40ccbd5d4d7b09e9 |
File details
Details for the file pyparsing-2.1.2.win32-py3.3.exe
.
File metadata
- Download URL: pyparsing-2.1.2.win32-py3.3.exe
- Upload date:
- Size: 236.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4d85fe7f01c0909acf69f2c3624bbce4052fab6af83aa4cdb5683ef8f16ee58 |
|
MD5 | 9594874bf2eda310a0dbf925f7e0b2c5 |
|
BLAKE2b-256 | 04fa5b0bcfd7565ad8e3585d24f19f50ad5e199cdbc21f4b111abb93a695db78 |
File details
Details for the file pyparsing-2.1.2.win32-py2.7.exe
.
File metadata
- Download URL: pyparsing-2.1.2.win32-py2.7.exe
- Upload date:
- Size: 236.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f154074ce7ed990422fad8fcbcd1af2ee265751475872324d92082be7554e4fe |
|
MD5 | 83d7f29f913f74744c401affd0134d07 |
|
BLAKE2b-256 | e545ee133714509cfae176b31d24882286588774f16cbebcfa8e8b8ba8fa80cf |
File details
Details for the file pyparsing-2.1.2.win32-py2.6.exe
.
File metadata
- Download URL: pyparsing-2.1.2.win32-py2.6.exe
- Upload date:
- Size: 105.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ca31e257a14a2f1b17aad0fc0850ca194c6af2286035106b5dcb69e27f16c70 |
|
MD5 | d17753147d148fa32a1356294df4d994 |
|
BLAKE2b-256 | 52cdec5b38df38e74e408efc018018b904c0e5515ca91478bb59ca20ce5f4a9e |
File details
Details for the file pyparsing-2.1.2-py2.py3-none-any.whl
.
File metadata
- Download URL: pyparsing-2.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 39.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6396a972294b1834e6cfddc5b456f3382340bc0611a0f9523e1a148ca890840 |
|
MD5 | c93b1a94181567da9bcf092fa6a7c99e |
|
BLAKE2b-256 | f6f3d52ce91f76f99752f2cac7043cbfaba63e637aa92296c1837ea64ddb780a |