repl.it
Python

i need a simple parsing lib, and PEGs are cool

fork
loading
Files
  • main.py
  • builder.py
  • combinators.py
  • parser.peg
  • parser.py
  • state.py
  • token.py
main.py
1
2
3
4
5
6
7
8
grm = '''term = NUM / OPAREN sum CPAREN;
prod = term TIMES prod / term;
sum = prod PLUS sum / prod;
'''

import builder

print(builder.make_rules(grm).parse("term", ["NUM"]))
Fetching token
?