Advice on Python Parser Generators

PyParsing is a python tool to generate parsers. There are a lot of interesting examples.

Easy to get started:

from pyparsing import Word, alphas

# define grammar
greet = Word( alphas ) + "," + Word( alphas ) + "!"

# input string
hello = "Hello, World!"

# parse input string
print hello, "->", greet.parseString( hello )

I recommend that you check out Lark: https://github.com/erezsh/lark

It can parse ALL context-free grammars, it automatically builds an AST (with line & column numbers), and it accepts the grammar in EBNF format, which is simple to write and it's considered the standard.