Seems fairly similar to lpeg[0] once you go deep diving into its more advanced usages.
…which is one of my “once I get motivated enough” projects to rip the VM out of the lua library and use it standalone as a data conversion pipeline library/command line utility. The (now abandoned) python port started on that route but seems like they gave up after getting it somewhat working.
Probably a bit overkill if all you want to output is AST nodes but might be worth a look.