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 hackers with the skills:

python parsing peg

This project is part of:

Hack Week 10

Activity

  • over 8 years ago: rneuhauser added keyword "python" to this project.
  • over 8 years ago: rneuhauser added keyword "parsing" to this project.
  • over 8 years ago: rneuhauser added keyword "peg" to this project.
  • over 8 years ago: rneuhauser started this project.
  • over 8 years ago: rneuhauser originated this project.

  • Comments

    • rneuhauser
      over 8 years ago by rneuhauser | Reply

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

    Similar Projects

    Rewrite libkdumpfile Python binding using CFFI by ptesarik

    Project Description

    The [libkdumpfile](ht...


    Testing and adding GNU/Linux distributions on Uyuni by juliogonzalezgil

    Join the Gitter channel! [https://gitter.im/uy...


    OMEMO Hexchat plugin by dknorr

    [comment]: # (Please use the project descriptio...


    Video For Linux 2 Camera monitor, frame capture, day/night exposure control and timelapse generator in python by dmair

    Use the V4L2 API in a PySide qt6.3 application ...


    web-based testing tracker for aquarist-labs's s3gw by jluis

    [comment]: # (Please use the project descriptio...