1. Unifying python parsing libraries

Python has a few alternatives for parsing, but some of them are unmaintained and most of them use their own format. A few examples:

(Please visit Ned Batchelder’s Python parsing tools post for a comprehensive list)

The first goal is to support of as many formats/libraries using compatible abstractions and running with the same python interpreter (2.7/3.x).

Most of the libraries mentioned in the first goal provide at least one of the following abstractions:

  • Testing: Grammar Definition + Input -> Bool
  • Parser: Grammar Definition + Input -> Parse Tree
  • Parser Generator: Grammar Definition -> Paser code (Python)
  • Translation: Grammar Definition + Input -> Translated Output

The second goal of pydsl is to provide uniform access to these functions in a format agnostic way. And on top of these abstractions, provide new high level functions that are based in the Parsing/Translation process

  • Validation: Details about why an input doesn’t conform a grammar (like w3c validator)
  • Diff: Print the differences between two inputs according to a grammar
  • Part extraction: Get the subparts of an input according to a grammar (like groups in regular expressiones)
  • Guessing: Test an input against a collection of Grammars