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.0.6.zip
(1.3 MB
view details)
pyparsing-2.0.6.tar.gz
(1.1 MB
view details)
Built Distributions
pyparsing-2.0.6.win32-py3.5.exe
(235.2 kB
view details)
pyparsing-2.0.6.win32-py3.4.exe
(235.2 kB
view details)
pyparsing-2.0.6.win32-py3.3.exe
(235.2 kB
view details)
pyparsing-2.0.6.win32-py2.7.exe
(235.2 kB
view details)
pyparsing-2.0.6.win32-py2.6.exe
(104.7 kB
view details)
File details
Details for the file pyparsing-2.0.6.zip
.
File metadata
- Download URL: pyparsing-2.0.6.zip
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 697f04b1b5d01741f4f7b7267ff2f2cc845c336e65efa71609339a250a0e9c72 |
|
MD5 | cbad9bc8ae80de503f634b492701f341 |
|
BLAKE2b-256 | fbbf77bc958adb8df3119ad87581d218ab2527757dc0f70a2343b507bb7f23b0 |
File details
Details for the file pyparsing-2.0.6.tar.gz
.
File metadata
- Download URL: pyparsing-2.0.6.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aea69042752ad7e9c436eea6ae5d40e73642e27f50edb6da4a2532030ef532da |
|
MD5 | a2d85979e33a6600148c6383d3d8de67 |
|
BLAKE2b-256 | 1610744034d57ebb4496d881dddd022e8be22a0312b0468f97352bbc6d8e1e6b |
File details
Details for the file pyparsing-2.0.6.win32-py3.5.exe
.
File metadata
- Download URL: pyparsing-2.0.6.win32-py3.5.exe
- Upload date:
- Size: 235.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b42560b839cc86097ed77253b948cc88ecaa6e65f5328063527e5718075b5143 |
|
MD5 | 8acb151ea4f74d2c093b60ffd8dc4d6e |
|
BLAKE2b-256 | 24faa5b4276f32f8a982c5c44517ae6ff586f41433db8b809e68e94abae4b7c6 |
File details
Details for the file pyparsing-2.0.6.win32-py3.4.exe
.
File metadata
- Download URL: pyparsing-2.0.6.win32-py3.4.exe
- Upload date:
- Size: 235.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a1aeb7a3f6b8471aa64cc57748e06fc353e7a5b995c5d0573fbf237cdebb657 |
|
MD5 | bf6ff8bc7d4d86563b100a8f880570a7 |
|
BLAKE2b-256 | 7bb11fb09b7ea9892ef03a763f3f7e34dfc0b490d305754d5ca8a25a69b16167 |
File details
Details for the file pyparsing-2.0.6.win32-py3.3.exe
.
File metadata
- Download URL: pyparsing-2.0.6.win32-py3.3.exe
- Upload date:
- Size: 235.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa45e8c51d4936eac407b632d25c16687607a94b5160ad8abba0fb546ba30528 |
|
MD5 | 5ef3cc8dac17836a031b2ca2cf7ecce9 |
|
BLAKE2b-256 | 273576f4b321d5ee22768d2a23d1a7b945313719550fa35cf8d171eacc59ab94 |
File details
Details for the file pyparsing-2.0.6.win32-py2.7.exe
.
File metadata
- Download URL: pyparsing-2.0.6.win32-py2.7.exe
- Upload date:
- Size: 235.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a032affeff5237982f61c2cf33a0a42f6695d51b0ebfaf2f3841a634dde25071 |
|
MD5 | 1dbd7522b60a8f5b9dd0ce995874f95d |
|
BLAKE2b-256 | 1c701cb606b27887f8cf502a1bbfadd517411d7a6075268022c6b48f0468f446 |
File details
Details for the file pyparsing-2.0.6.win32-py2.6.exe
.
File metadata
- Download URL: pyparsing-2.0.6.win32-py2.6.exe
- Upload date:
- Size: 104.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bfc08ac228ae3c549d3510e62369a48137725d98b39a686bf86c6c5a1d79c3a |
|
MD5 | 51e885d1f35a15d2f594a453a80855a0 |
|
BLAKE2b-256 | 505d6bc29fc683a5b0e42ad07a918062e344d390ae61ec02bfe239291ff476ca |
File details
Details for the file pyparsing-2.0.6-py2.py3-none-any.whl
.
File metadata
- Download URL: pyparsing-2.0.6-py2.py3-none-any.whl
- Upload date:
- Size: 38.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23897437d77a627264b176ccc726b1fa0e2d5e4f44c1aa6b6ac880639b8b1ac3 |
|
MD5 | 0b2ddfa95fc7381cfa0b5dc573d1fe26 |
|
BLAKE2b-256 | 75afdbfea3f224a6980c18336a0feefc37f8011cf2b356e6090a35f2cd23f686 |