[Python-ideas] Built-in parsing library

Terry Reedy tjreedy at udel.edu
Mon Apr 1 18:12:00 EDT 2019


On 4/1/2019 1:14 AM, Guido van Rossum wrote:
> We do have a parser generator in the standard library:
> https://github.com/python/cpython/tree/master/Lib/lib2to3/pgen2

It is effectively undocumented and by inference discouraged from use. 
The entry for lib2to3 in the 2to3 doc:
https://docs.python.org/3/library/2to3.html#module-lib2to3
"
lib2to3 - 2to3’s library
Source code: Lib/lib2to3/
Note: The lib2to3 API should be considered unstable and may change 
drastically in the future.

help(pgen) is not much more helpful.
:
Help on package lib2to3.pgen2 in lib2to3:

NAME
     lib2to3.pgen2 - The pgen2 package.

PACKAGE CONTENTS
     conv
     driver
     grammar
     literals
     parse
     pgen
     token
     tokenize

FILE
     c:\programs\python38\lib\lib2to3\pgen2\__init__.py



-- 
Terry Jan Reedy




More information about the Python-ideas mailing list