Change the future

Sunday 1:50 p.m.–2:20 p.m.

Worry-Free Parsers with Parsley

Allen Short

Audience level:
Useful Libraries


Writing parsers has often been a task difficult for programmers to take on. Many of the tools available for parsing require writing grammar rules and code that work very different from everything else in Python. Parsley is a library that mixes the benefits of concise rule-based grammars with a parsing model that works the way you expect Python code to work.


  • You're Scared Of Parsing - For Good Reasons

    • Un-Pythonic Libraries
    • Weird Code Organization
    • Shift-Reduce Conflicts
  • But Regular Expressions Make Sense

    • Simple API
    • (Sort Of) Simple Execution Model
  • Parsley Can Help

    • Comparison of string matching with re and with parsley
    • Named rules allow more complex matches
    • Parsing actions allow building results
    • Grammars are classes, parsing rules are methods
    • Inheritance and method calls work like normal
  • But Wait, There's More

    • Precise syntax error reporting
    • Grammar debugging tools
    • Streaming parsers for network data