diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2019-03-01 23:34:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-01 23:34:44 (GMT) |
commit | 1f24a719e7be5e49b876a5dc7daf21d01ee69faa (patch) | |
tree | 8f8f56cab78ef671a8cb7f54b8ec2495d9a435e6 /PCbuild | |
parent | 7eebbbd5b3907447eddadf5cb7cb1cc9230d15b2 (diff) | |
download | cpython-1f24a719e7be5e49b876a5dc7daf21d01ee69faa.zip cpython-1f24a719e7be5e49b876a5dc7daf21d01ee69faa.tar.gz cpython-1f24a719e7be5e49b876a5dc7daf21d01ee69faa.tar.bz2 |
bpo-35808: Retire pgen and use pgen2 to generate the parser (GH-11814)
Pgen is the oldest piece of technology in the CPython repository, building it requires various #if[n]def PGEN hacks in other parts of the code and it also depends more and more on CPython internals. This commit removes the old pgen C code and replaces it for a new version implemented in pure Python. This is a modified and adapted version of lib2to3/pgen2 that can generate grammar files compatibles with the current parser.
This commit also eliminates all the #ifdef and code branches related to pgen, simplifying the code and making it more maintainable. The regen-grammar step now uses $(PYTHON_FOR_REGEN) that can be any version of the interpreter, so the new pgen code maintains compatibility with older versions of the interpreter (this also allows regenerating the grammar with the current CI solution that uses Python3.5). The new pgen Python module also makes use of the Grammar/Tokens file that holds the token specification, so is always kept in sync and avoids having to maintain duplicate token definitions.
Diffstat (limited to 'PCbuild')
-rw-r--r-- | PCbuild/pythoncore.vcxproj | 6 | ||||
-rw-r--r-- | PCbuild/pythoncore.vcxproj.filters | 18 |
2 files changed, 0 insertions, 24 deletions
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 992c84f..bff7b95 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -161,7 +161,6 @@ <ClInclude Include="..\Include\longobject.h" /> <ClInclude Include="..\Include\marshal.h" /> <ClInclude Include="..\Include\memoryobject.h" /> - <ClInclude Include="..\Include\metagrammar.h" /> <ClInclude Include="..\Include\methodobject.h" /> <ClInclude Include="..\Include\modsupport.h" /> <ClInclude Include="..\Include\moduleobject.h" /> @@ -175,7 +174,6 @@ <ClInclude Include="..\Include\osmodule.h" /> <ClInclude Include="..\Include\parsetok.h" /> <ClInclude Include="..\Include\patchlevel.h" /> - <ClInclude Include="..\Include\pgen.h" /> <ClInclude Include="..\Include\pgenheaders.h" /> <ClInclude Include="..\Include\pyhash.h" /> <ClInclude Include="..\Include\py_curses.h" /> @@ -372,12 +370,8 @@ <ClCompile Include="..\Objects\unicodeobject.c" /> <ClCompile Include="..\Objects\weakrefobject.c" /> <ClCompile Include="..\Parser\acceler.c" /> - <ClCompile Include="..\Parser\bitset.c" /> - <ClCompile Include="..\Parser\firstsets.c" /> - <ClCompile Include="..\Parser\grammar.c" /> <ClCompile Include="..\Parser\grammar1.c" /> <ClCompile Include="..\Parser\listnode.c" /> - <ClCompile Include="..\Parser\metagrammar.c" /> <ClCompile Include="..\Parser\myreadline.c" /> <ClCompile Include="..\Parser\node.c" /> <ClCompile Include="..\Parser\parser.c" /> diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index 293bded..0303074 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -234,9 +234,6 @@ <ClInclude Include="..\Include\memoryobject.h"> <Filter>Include</Filter> </ClInclude> - <ClInclude Include="..\Include\metagrammar.h"> - <Filter>Include</Filter> - </ClInclude> <ClInclude Include="..\Include\methodobject.h"> <Filter>Include</Filter> </ClInclude> @@ -270,9 +267,6 @@ <ClInclude Include="..\Include\patchlevel.h"> <Filter>Include</Filter> </ClInclude> - <ClInclude Include="..\Include\pgen.h"> - <Filter>Include</Filter> - </ClInclude> <ClInclude Include="..\Include\pgenheaders.h"> <Filter>Include</Filter> </ClInclude> @@ -836,24 +830,12 @@ <ClCompile Include="..\Parser\acceler.c"> <Filter>Parser</Filter> </ClCompile> - <ClCompile Include="..\Parser\bitset.c"> - <Filter>Parser</Filter> - </ClCompile> - <ClCompile Include="..\Parser\firstsets.c"> - <Filter>Parser</Filter> - </ClCompile> - <ClCompile Include="..\Parser\grammar.c"> - <Filter>Parser</Filter> - </ClCompile> <ClCompile Include="..\Parser\grammar1.c"> <Filter>Parser</Filter> </ClCompile> <ClCompile Include="..\Parser\listnode.c"> <Filter>Parser</Filter> </ClCompile> - <ClCompile Include="..\Parser\metagrammar.c"> - <Filter>Parser</Filter> - </ClCompile> <ClCompile Include="..\Parser\myreadline.c"> <Filter>Parser</Filter> </ClCompile> |