logo
What's New
What's New
  Popular
Popular
  Top Rated
Top Rated
  Search
Search


Search :  

How to Add Link |   Modify Link   |   Login |     Register  |  Getting Rated |  Link to Us |  Feedback Us


Sponsors
FlashAdvisor.com
Web Directory
Custom Offshore Software Development
phpld Hacks
Software Download
Your Site Link




Categories
    3DS MAX
    ASP
    C And C++
    ColdFusion
    Database
    Dreamweaver
    Flash
    HTML
    Java
    JavaScript
    Linux
    Maya
    MS Excel
    MS PowerPoint
    MS Word
    Paint Shop Pro
    Perl and CGI
    Photoshop
    PHP
    Premiere
    Python
    Visual Basic
    Web Hosting
    XML
 

 

Charming Python: Parsing with the SimpleParse module
  

Home  » Python » Miscellaneous  

Many parsing tools have been written for Python. This column discusses a high-level parsing language built on top of Python. SimpleParse provides an EBNF-style syntax on top of mxTextTools that can greatly clarify the expression of grammars. Like most programmers, I have frequently needed to identify parts and structures that exist inside textual documents: log files, configuration files, delimited data, and more free-form (but still semi-structured) report formats. All of these documents have their own "little languages" for what can occur within them. The way I have programmed these informal parsing tasks has always been somewhat of a hodgepodge of custom state-machines, regular expressions, and context-driven string tests. The pattern in these programs was always, roughly, "read a bit of text, figure out if we can make something of it, maybe read a bit more text afterwards, keep trying." Parsers of the formal variety distill descriptions of the parts and structures in documents into concise, clear, and declarative rules for how to identify what makes up a document. The declarative aspect is particularly interesting here. All my old ad hoc parsers were imperative in flavor: read some characters, make some decisions, accumulate some variables, rinse, repeat. As this column's installments on functional programming have observed, the recipe style of program flow is comparatively error-prone and difficult to maintain.

Hits: 432
Rate:   0.0(out of 5)  
Vote : 0   
Submit Date  : 2006-03-29
Submit By  : www-128.ibm
View Tutorial Charming Python: Parsing with the SimpleParse module
 Add Review
 Report Error
Rating Graph

0.0%
0.0%
0.0%
0.0%
100.0%
 1  2  3  4  5 
Rate This :
More Tutorials by this user

An advanced GUI library for Python - PyQT
 An advanced GUI library for Python - PyQT
Improving the social infrastructure of Python: pydoc and dis
 Improving the social infrastructure of Python: pydoc and distutils modules
DeveloperWorks: Getting to know Midgard
 DeveloperWorks: Getting to know Midgard
Improving the social infrastructure of Python: pydoc and dis
 Improving the social infrastructure of Python: pydoc and distutils modules
Extending Python and Zope in C
 Extending Python and Zope in C
The Python Web Services Developer, Part 2
 The Python Web Services Developer, Part 2
Developing a full-text indexer in Python
 Developing a full-text indexer in Python
How to use Python's xml_objectify
 How to use Python's xml_objectify
Python for the PalmOS
 Python for the PalmOS
Python: Text processing in Python for beginners
 Python: Text processing in Python for beginners
  
Home | Sitemap | Feedback | Advertise with us
Best viewed in 800x600 resolution with Internet Explorer.
Site Developed and Hosted by EthicSolutions

Flash Tutorials    TemplateAdvisor.com    WebMastersHome.com

    Reseller Hosting    Reseller Hosting Linux