How to generate standalone parser in Python?

Viewed 176

I would like to generate a Python parser for a custom language. As I am new to parsing, my only requirement so far is that the generated module shall not depend on the generator.

I learned Tatsu, as it can generate the parser as Python module. But when I review the generated module, it still begins with

from tatsu.buffering import Buffer
from tatsu.parsing import Parser
from tatsu.parsing import tatsumasu, leftrec, nomem
...

Is there a way to generate standalone (depending only on standard Python libraries) parser module using Tatsu? If not, do I have any other option?

1 Answers

Take a look at pegen, by Guido van Rossum, Pablo Galindo, et al.

It is the basis for the Python parser in Python 3.9.

Related