The tl;dr is that actions specified in the grammar are specific to the target language. So if you want to use the pegen tool to generate both Python and C code for the same grammar, you would need two grammar files with the same grammar but different actions. Since our goal here is just to generate a parser for use in CPython that's not a problem. Other PEG parser generators make different choices, e.g. TatSu puts semantics actions in a separate file (

On Sun, Apr 5, 2020 at 11:06 AM Pablo Galindo Salgado <> wrote:
> The only thing I'm missing from the PEP is more detail about how the
cross-language nature of the parser actions are handled.

Expanded the "actions" section in the PEP here:
Python-Dev mailing list --
To unsubscribe send an email to
Message archived at
Code of Conduct:

--Guido van Rossum (
Pronouns: he/him (why is my pronoun here?)