Describes an application that reads
.calendar files using the Python
programming language. The application demonstrates
Python's pyparsing recursive descent parsing module. All
source code is included in lightweight literate form.
Table of Contents
icalparse: Driver script for the
The ical application is a calendar manager from the Unix world that dates back well before the year 2000. The original was written in the Tcl/tk language by Sanjay Ghemawat; refer to the Wikipedia page for more information. (This application is no relation to Apple's iCal product or the iCalendar data exchange standard.)
The icalparse project arose from the author's need to salvage historical information from his ical appointments, including important dates such as birthdays.
The format of the
.calendar file that this application uses
to store its information is a rather unusual free-field
[ square brackets ] to group
data. This reduces the problem of data extraction to
parsing problem, using a context-free grammar. Python's
pyparsing module makes it easy to implement a recursive
descent parser. This tool has much more power than
regular-expression-based approaches, but requires
considerably less infrastructure than a full-blown
This project has, then, two purposes. It is a tool for
others who may wish to extract data from their
files. It is also a demonstration of the power and
simplicity of pyparsing.