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 (https://tatsu.readthedocs.io/en/stable/semantics.html).

On Sun, Apr 5, 2020 at 11:06 AM Pablo Galindo Salgado <pablogsal@gmail.com> 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: https://github.com/python/peps/pull/1357
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/EJMHASPUOAW7R2BKJCCVI4BGQRLN3ZRX/
Code of Conduct: http://python.org/psf/codeofconduct/


--
--Guido van Rossum (python.org/~guido)
Pronouns: he/him (why is my pronoun here?)