pyg will be a PEG parser library formed as an internal Python DSL. it will be used in cramex, a copycat of cram with expect support.

The surface is heading to resemble Boost.Spirit: grammars are composed using a vaguely (xBNF/PEG)-like syntax enabled through operator overloading.

>>> from pyg import Rule, chr_, int_

>>> n = Rule('number')
>>> o = Rule('operator')
>>> e = Rule('expression')

>>> e %= n >> o >> n
>>> o %= chr_('+-')
>>> n %= int_

>>> e.matches('42 + 69')
True, None
>>> e.matches('69')
True, None
>>> e.matches('42 69')
False, "Failed on line 1 column 3:\n42 69\n  ^\n"

Looking for mad skills in:

python parsing peg

This project is part of:

Hack Week 10

Activity

  • over 5 years ago: rneuhauser added keyword "peg" to pyg: PEG parsing runtime for Python
  • over 5 years ago: rneuhauser added keyword "parsing" to pyg: PEG parsing runtime for Python
  • over 5 years ago: rneuhauser added keyword "python" to pyg: PEG parsing runtime for Python
  • over 5 years ago: rneuhauser started pyg: PEG parsing runtime for Python
  • over 5 years ago: rneuhauser originated pyg: PEG parsing runtime for Python
  • Show History

    Comments

    • rneuhauser
      over 5 years ago by rneuhauser | Reply

      https://github.com/roman-neuhauser/py-impala - Import packages and modules from arbitrary directories and files

    Similar Projects

    Improve Conference Recording Experience by dmolkentin

    Problem statement

    Right now, we have diff...


    N00B Project: 2D game in Python by bhertwig

    Two trainees embarking on their coding adventur...


    logorator: an offline internal analytics tool by dleidi

    There are customer use cases where sharing info...


    Extend urlwatch to support monitoring of GitHub (and other git) repos by kbabioch

    I'm currently using [urlwatch](https://github.c...


    Supportconfig improvements for SOC by pedrivo

    The supportconfig tool is a great resource for ...