pyparsing-1.5.3
所属分类:其他
开发工具:Python
文件大小:1537KB
下载次数:16
上传日期:2010-07-26 12:13:00
上 传 者:
baiziyi008
说明: pyparsing is a general parsing module for Python. Grammars are implemented directly in the client code using parsing objects, instead of externally, as with lex/yacc-type tools. Includes simple examples for parsing SQL, CORBA IDL, and 4-function math.
文件列表:
pyparsing-1.5.3\CHANGES (65922, 2010-06-24)
pyparsing-1.5.3\HowToUsePyparsing.html (78057, 2009-04-13)
pyparsing-1.5.3\LICENSE (1041, 2007-10-15)
pyparsing-1.5.3\PKG-INFO (639, 2010-06-24)
pyparsing-1.5.3\pyparsingClassDiagram.JPG (236402, 2009-04-13)
pyparsing-1.5.3\pyparsingClassDiagram.PNG (141354, 2009-04-13)
pyparsing-1.5.3\pyparsing_py2.py (155291, 2010-06-24)
pyparsing-1.5.3\pyparsing_py3.py (155277, 2010-06-24)
pyparsing-1.5.3\robots.txt (35, 2006-05-05)
pyparsing-1.5.3\setup.py (1645, 2010-06-22)
pyparsing-1.5.3\docs\HowToUsePyparsing.html (78057, 2009-04-13)
pyparsing-1.5.3\docs\pycon06-AdventureEngineUsingPyparsing-notes.pdf (48227, 2006-03-28)
pyparsing-1.5.3\docs\pycon06-IntroToPyparsing-notes.pdf (82733, 2006-03-28)
pyparsing-1.5.3\docs\pyparsingClassDiagram.JPG (236402, 2009-04-13)
pyparsing-1.5.3\docs\pyparsingClassDiagram.PNG (141354, 2009-04-13)
pyparsing-1.5.3\docs\examples\AcManForm.dfm (39137, 2003-02-28)
pyparsing-1.5.3\docs\examples\adventureEngine.py (19432, 2006-02-24)
pyparsing-1.5.3\docs\examples\chemicalFormulas.py (2052, 2007-10-26)
pyparsing-1.5.3\docs\examples\cLibHeader.py (722, 2006-01-02)
pyparsing-1.5.3\docs\examples\commasep.py (740, 2004-01-08)
pyparsing-1.5.3\docs\examples\configParse.py (1856, 2003-12-18)
pyparsing-1.5.3\docs\examples\dfmparse.py (6917, 2004-05-11)
pyparsing-1.5.3\docs\examples\dhcpd_leases_parser.py (3160, 2008-03-30)
pyparsing-1.5.3\docs\examples\dictExample.py (1602, 2003-12-18)
pyparsing-1.5.3\docs\examples\dictExample2.py (2142, 2006-07-01)
pyparsing-1.5.3\docs\examples\ebnf.py (4247, 2004-03-09)
pyparsing-1.5.3\docs\examples\ebnftest.py (2310, 2004-03-05)
pyparsing-1.5.3\docs\examples\eval_arith.py (6272, 2009-04-17)
pyparsing-1.5.3\docs\examples\fourFn.py (6540, 2006-09-03)
pyparsing-1.5.3\docs\examples\getNTPservers.py (1056, 2004-03-06)
pyparsing-1.5.3\docs\examples\getNTPserversNew.py (976, 2005-10-30)
pyparsing-1.5.3\docs\examples\greeting.py (371, 2006-11-26)
pyparsing-1.5.3\docs\examples\greetingInGreek.py (440, 2006-03-06)
pyparsing-1.5.3\docs\examples\greetingInKorean.py (479, 2006-03-06)
pyparsing-1.5.3\docs\examples\holaMundo.py (1047, 2007-03-31)
pyparsing-1.5.3\docs\examples\htmlStripper.py (1206, 2007-06-20)
pyparsing-1.5.3\docs\examples\httpServerLogParser.py (3573, 2006-09-17)
pyparsing-1.5.3\docs\examples\idlParse.py (7915, 2004-12-17)
... ...
====================================
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
"
, !"):
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.3.2 or later.)
Documentation
=============
See:
HowToUsePyparsing.html
License
=======
MIT License. See header of pyparsing.py
History
=======
See CHANGES file.
近期下载者:
相关文件:
收藏者: