Via the Stack Overflow Blog, an excellent post on writing parsers: http://www.cforcoding.com/2010/01/jmd-markdown- and-brief-overview-of.html