>The only thing I'm missing from the PEP is more detail about how the > cross-language nature of the parser actions are handled. The example covers > just C, and the description of the actions says they're C expressions. The > only mention of Python code generation is for alternatives without actions. > Is the intent that the actions are cross-language, or translated to Python > somehow, or is the support for generating a Python-based parser merely for >. debugging, as that action suggests?
Oh, good point. Thanks for pointing that out. We certainly need to explain that a bit better. The current situation is that actions support both Python and C code. They are basically pieces of code that will be included in the resulting program, no matter on what language is written in. For instance, we use the Python generator to generate the code that parses the grammar for the generator itself. The output is written in Python and the metagrammar uses actions written in Python: https://github.com/we-like-parsers/cpython/blob/pegen/Tools/peg_generator/pegen/metagrammar.gram So regarding the usage of Python code generation, is certainly useful for debugging but is actually used by the generator itself to bootstrap a section of it (the one that parses grammars). The feeling of bootstrapping parsers never gets old and is one of the most fun parts to do :) I will prepare a PR soon to complement the section about actions in the PEP. _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@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/62FBT5KVUES5W4SXF22WAXXE2E32Y6WT/ Code of Conduct: http://python.org/psf/codeofconduct/