summaryrefslogtreecommitdiffstats
path: root/Parser/pgen
Commit message (Collapse)AuthorAgeFilesLines
* Fix typos in the documentation of Parser/pgen (GH-15416)Shashi Ranjan2019-08-241-7/+7
| | | | Co-Authored-By: Antoine <43954001+awecx@users.noreply.github.com>
* Refactor Parser/pgen and add documentation and explanations (GH-15373)Pablo Galindo2019-08-227-332/+753
| | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor Parser/pgen and add documentation and explanations To improve the readability and maintainability of the parser generator perform the following transformations: * Separate the metagrammar parser in its own class to simplify the parser generator logic. * Create separate classes for DFAs and NFAs and move methods that act exclusively on them from the parser generator to these classes. * Add docstrings and comment documenting the process to go from the grammar file into NFAs and then DFAs. Detail some of the algorithms and give some background explanations of some concepts that will helps readers not familiar with the parser generation process. * Select more descriptive names for some variables and variables. * PEP8 formatting and quote-style homogenization. The output of the parser generator remains the same (Include/graminit.h and Python/graminit.c remain untouched by running the new parser generator).
* Remove duplicate call to strip method in Parser/pgen/token.py (GH-14938)Hansraj Das2019-07-241-6/+2
|
* use `const` in graminit.c (GH-12713)tyomitch2019-04-231-3/+3
|
* bpo-36623: Clean parser headers and include files (GH-12253)Pablo Galindo2019-04-131-1/+0
| | | After the removal of pgen, multiple header and function prototypes that lack implementation or are unused are still lying around.
* bpo-36143: Regenerate Lib/keyword.py from the Grammar and Tokens file using ↵Pablo Galindo2019-03-251-0/+60
| | | | | | pgen (GH-12456) Now that the parser generator is written in Python (Parser/pgen) we can make use of it to regenerate the Lib/keyword file that contains the language keywords instead of parsing the autogenerated grammar files. This also allows checking in the CI that the autogenerated files are up to date.
* Remove d_initial from the parser as it is unused (GH-12212)tyomitch2019-03-091-1/+1
| | | d_initial, the first state of a particular DFA in the parser has always been initialized to 0 in the old pgen as well as the new pgen. As this value is not used and the first state of each DFA is assumed to be the first element in the array representing it, remove d_initial from the parser to reduce complexity.
* Clean implementation of Parser/pgen and fix some style issues (GH-12156)Pablo Galindo2019-03-044-28/+14
|
* bpo-35808: Retire pgen and use pgen2 to generate the parser (GH-11814)Pablo Galindo2019-03-015-0/+642
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.