Skip to content

PyParsing

I just bought and read the Getting Started with Pyparsing PDF book. And it’s good. PyParsing is a way of building a parser using Python code. You should think Yacc/Lex, but readable. It can be used to parse text, and it can also handle HTML.

This is the example from the PyParsing website :

  from pyparsing import Word, alphas
  greet = Word( alphas ) + "," + Word( alphas ) + "!" # <-- grammar defined here
  hello = "Hello, World!"
  print hello, "->", greet.parseString( hello )

OnLamp.com had a good article called Building Recursive Descent Parsers with Python, which is a good starting point. But the book is better.

One Comment

  1. Paul McGuire wrote:

    Thanks for the kind review – you are the first to blog or otherwise comment on my book. I’m glad the first review was a positive one! :)

    Wednesday, October 24, 2007 at 7:35 am | Permalink