A PEG Parser Combinator Generator with Tree Annotation
pip3 install pegtree
import pegtree as pg
# 1. load a sample grammar 'math.tpeg'
peg = pg.grammar('math.tpeg')
# 2. generate parser from a grammar
parser = pg.generate(peg)
# 3. parse an input text, then you will obtain parse tree
tree = parser('1+2*3')
print(repr(tree))