I\'m looking to write a Python import filter or preprocessor for source files that are essentially Python with extra language elements. The goal is to read the source file, pars
I would recommend that you check out my library: https://github.com/erezsh/lark
It can parse ALL context-free grammars, automatically builds an AST (with line & column numbers), and accepts the grammar in EBNF format, which is considered the standard.
It can easily parse a language like Python, and it can do so faster than any other parsing library written in Python.
In fact, there's already an example python grammar and parser