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.7.zip
(1.4 MB
view details)
pyparsing-2.1.7.tar.gz
(1.2 MB
view details)
Built Distributions
pyparsing-2.1.7.win32-py3.5.exe
(514.9 kB
view details)
pyparsing-2.1.7.win32-py3.4.exe
(245.6 kB
view details)
pyparsing-2.1.7.win32-py3.3.exe
(245.6 kB
view details)
pyparsing-2.1.7.win32-py2.7.exe
(250.7 kB
view details)
pyparsing-2.1.7.win32-py2.6.exe
(250.7 kB
view details)
File details
Details for the file pyparsing-2.1.7.zip
.
File metadata
- Download URL: pyparsing-2.1.7.zip
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b02099d786d77eab58fca3148df412f7d3b19bc5a5bd38e1d6e52f969b629320 |
|
MD5 | 60840e1f7bcddfd1ef0fa8aded1e1eed |
|
BLAKE2b-256 | f635ddda12a5e35e2d99d26e657b68f20b1ba0d19b46e16fe3812f485818e744 |
File details
Details for the file pyparsing-2.1.7.tar.gz
.
File metadata
- Download URL: pyparsing-2.1.7.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7faf33a14ab1413d9a73ffe4b5a02d604cff6fba2bc39d5ea71b10ffc67d75ac |
|
MD5 | 75a827a047e25c0abd17a5c63d582d8b |
|
BLAKE2b-256 | df5368733d03b0577c6c638b3009151fed8ac51bf34a485565910b764cdc5d3b |
File details
Details for the file pyparsing-2.1.7.win32-py3.5.exe
.
File metadata
- Download URL: pyparsing-2.1.7.win32-py3.5.exe
- Upload date:
- Size: 514.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1f1829532a2993e500765669a9e7a2f8ec8250a5e39ae0405766af3e66a2f78 |
|
MD5 | 120fed02ab655e686a55872c400134c8 |
|
BLAKE2b-256 | 184e43e275ec27e73f11fff1c9180012c05bb09284cb31edf5c3e6895828e473 |
File details
Details for the file pyparsing-2.1.7.win32-py3.4.exe
.
File metadata
- Download URL: pyparsing-2.1.7.win32-py3.4.exe
- Upload date:
- Size: 245.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d67122c300e15452476096f9a7bdb8d64d9dd62825e8588ce1c77abc03fd9912 |
|
MD5 | bc70fcb7925341e1017d33d1a14c3910 |
|
BLAKE2b-256 | 8b36b2520660ca59e0dca8ae21edb2c9bb9e2dd8b0f2ce96d4c08309b57f04a6 |
File details
Details for the file pyparsing-2.1.7.win32-py3.3.exe
.
File metadata
- Download URL: pyparsing-2.1.7.win32-py3.3.exe
- Upload date:
- Size: 245.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdb7933334976c56dee64bf45aea7278894ef04f7424a7ed37d95fdd3df37496 |
|
MD5 | 6faf3c361ee0a5b10629f30eed5f5108 |
|
BLAKE2b-256 | 4d1d3af6a92f3405e3fd4571edaafb7fa12cff42aa086b96fadbc743f50175a2 |
File details
Details for the file pyparsing-2.1.7.win32-py2.7.exe
.
File metadata
- Download URL: pyparsing-2.1.7.win32-py2.7.exe
- Upload date:
- Size: 250.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b9a68f12f7e9a3e489fe0012716a3484d83ee305a0c350c4ab92b4c7a389c01 |
|
MD5 | ecb79398da908b50507429f0f8a54147 |
|
BLAKE2b-256 | 1d35ed402fcac08623538aaa927e92830eedc15b65d60b834e1de3d2398a5771 |
File details
Details for the file pyparsing-2.1.7.win32-py2.6.exe
.
File metadata
- Download URL: pyparsing-2.1.7.win32-py2.6.exe
- Upload date:
- Size: 250.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e81fbfb5551f1dac9fcfc13dbbd156d08c47de70a6ab74ac9c5dba3547e4aeb |
|
MD5 | 7e896dd5d577dc186aa4a7350559ad7a |
|
BLAKE2b-256 | 936fbb053f6892006f644b33df3905025515557d88809ee4f6b3b15463eae0d5 |
File details
Details for the file pyparsing-2.1.7-py2.py3-none-any.whl
.
File metadata
- Download URL: pyparsing-2.1.7-py2.py3-none-any.whl
- Upload date:
- Size: 53.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5956ee068ff3db81684883206c6735dce5d99517f53a960cb464c4652de1ed56 |
|
MD5 | e2af1c41beca4b07502a958f1542f492 |
|
BLAKE2b-256 | 5202efeb2e572c0fc9524c36701bab40df4d77c2fc00d2854e674f9f7e253836 |