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.10.zip
(1.4 MB
view details)
pyparsing-2.1.10.tar.gz
(1.2 MB
view details)
Built Distributions
pyparsing-2.1.10.win32-py3.5.exe
(517.2 kB
view details)
pyparsing-2.1.10.win32-py3.4.exe
(247.9 kB
view details)
pyparsing-2.1.10.win32-py3.3.exe
(247.9 kB
view details)
pyparsing-2.1.10.win32-py2.7.exe
(253.0 kB
view details)
pyparsing-2.1.10.win32-py2.6.exe
(253.0 kB
view details)
File details
Details for the file pyparsing-2.1.10.zip
.
File metadata
- Download URL: pyparsing-2.1.10.zip
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0aa6e8d8c3f9c447a95a33bb04b103ead630121c3f4233e2980348cecf8b69c8 |
|
MD5 | 3732506980ff0a695d003e8c781d8394 |
|
BLAKE2b-256 | 30c5a4f214f66fbdb868d20d5811635d08e386f63a9591c5756ef717b3115796 |
File details
Details for the file pyparsing-2.1.10.tar.gz
.
File metadata
- Download URL: pyparsing-2.1.10.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 811c3e7b0031021137fc83e051795025fcb98674d07eb8fe922ba4de53d39188 |
|
MD5 | 065908b92904e0d3634eb156f44cc80e |
|
BLAKE2b-256 | 38bbbf325351dd8ab6eb3c3b7c07c3978f38b2103e2ab48d59726916907cd6fb |
File details
Details for the file pyparsing-2.1.10.win32-py3.5.exe
.
File metadata
- Download URL: pyparsing-2.1.10.win32-py3.5.exe
- Upload date:
- Size: 517.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fa446b1c36509e75d883a1a552b51dda9b82bfd914a24ded17ceb5d90b53cc5 |
|
MD5 | ac841c34053c12528590ad13c4369153 |
|
BLAKE2b-256 | 3fea1910ae1f746aa225eb56f63a85c6ae92f65c0b4a7d855e2df9babd2a1963 |
File details
Details for the file pyparsing-2.1.10.win32-py3.4.exe
.
File metadata
- Download URL: pyparsing-2.1.10.win32-py3.4.exe
- Upload date:
- Size: 247.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a163f9079b84da728e4967e3f36476ed168d86b2fc2f49c6e609125600f9d60b |
|
MD5 | 8406e978fe59578d72656f8cd8282255 |
|
BLAKE2b-256 | cad9d44a92cca7ad1c86c5ab81f8f5dd4101fcc9a48e1397da93ab4c51374eee |
File details
Details for the file pyparsing-2.1.10.win32-py3.3.exe
.
File metadata
- Download URL: pyparsing-2.1.10.win32-py3.3.exe
- Upload date:
- Size: 247.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a00f6e57bf4e2b3d999223d36c14d839f12145d5b1f12126124424e8c43d856e |
|
MD5 | 0137d2a9c9e27f9f7380cccfe09c96bc |
|
BLAKE2b-256 | b9e5ac3b3229c8212938f012b96fd2e92fb6d2989faf7251d9c7531c6a2e5285 |
File details
Details for the file pyparsing-2.1.10.win32-py2.7.exe
.
File metadata
- Download URL: pyparsing-2.1.10.win32-py2.7.exe
- Upload date:
- Size: 253.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fef8411ad305909b1a679471d66f25ef4477f24666598deceb4bb640c2eb6c2 |
|
MD5 | 0c89b4128280210b905e9fe2710cfad8 |
|
BLAKE2b-256 | ca3b2a771cf75eece6348f5353833510ce2b45211b55d216b28bbe3176cf0771 |
File details
Details for the file pyparsing-2.1.10.win32-py2.6.exe
.
File metadata
- Download URL: pyparsing-2.1.10.win32-py2.6.exe
- Upload date:
- Size: 253.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a27bf672302765ab04ed5c976dd44c55c0702f7a25a5e5e78bc91207d5b07da4 |
|
MD5 | f749ace29740ddc192c6d113ace14a92 |
|
BLAKE2b-256 | 2a5108a9d4a75e08926fba4038f4c2cb76d751654d6286202a412717bacef746 |
File details
Details for the file pyparsing-2.1.10-py2.py3-none-any.whl
.
File metadata
- Download URL: pyparsing-2.1.10-py2.py3-none-any.whl
- Upload date:
- Size: 56.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67101d7acee692962f33dd30b5dce079ff532dd9aa99ff48d52a3dad51d2fe84 |
|
MD5 | 5e707ac42995e52ae06df4325ac07ebb |
|
BLAKE2b-256 | 2bf7e5a178fc3ea4118a0edce2a8d51fc14e680c745cf4162e4285b437c43c94 |