88========
99
1010There's more to changing Python's grammar than editing
11- :file: `Grammar/python.gram `. Here's a checklist.
11+ :cpy- file: `Grammar/python.gram `. Here's a checklist.
1212
1313.. note ::
1414 These instructions are for Python 3.9 and beyond. Earlier
@@ -25,42 +25,45 @@ Checklist
2525
2626Note: sometimes things mysteriously don't work. Before giving up, try ``make clean ``.
2727
28- * :file: `Grammar/python.gram `: The grammar, with actions that build AST nodes. After changing
29- it, run ``make regen-pegen `` (or ``build.bat --regen `` on Windows), to
30- regenerate :file: `Parser/parser.c `.
28+ * :cpy- file: `Grammar/python.gram `: The grammar, with actions that build AST nodes.
29+ After changing it, run ``make regen-pegen `` (or ``build.bat --regen `` on Windows),
30+ to regenerate :cpy- file: `Parser/parser.c `.
3131 (This runs Python's parser generator, ``Tools/peg_generator ``).
3232
33- * :file: `Grammar/Tokens ` is a place for adding new token types. After
34- changing it, run ``make regen-token `` to regenerate :file: `Include/token.h `,
35- :file: `Parser/token.c `, :file: `Lib/token.py ` and
36- :file: `Doc/library/token-list.inc `. If you change both ``python.gram `` and `` Tokens ``,
37- run ``make regen-token `` before ``make regen-pegen ``. On Windows,
38- ``build.bat --regen `` will regenerate both at the same time.
33+ * :cpy- file: `Grammar/Tokens ` is a place for adding new token types. After
34+ changing it, run ``make regen-token `` to regenerate :cpy- file: `Include/token.h `,
35+ :cpy- file: `Parser/token.c `, :cpy- file: `Lib/token.py ` and
36+ :cpy- file: `Doc/library/token-list.inc `. If you change both ``python.gram ``
37+ and `` Tokens ``, run ``make regen-token `` before ``make regen-pegen ``.
38+ On Windows, ``build.bat --regen `` will regenerate both at the same time.
3939
40- * :file: `Parser/Python.asdl ` may need changes to match the grammar. Then run ``make
41- regen-ast `` to regenerate :file: `Include/Python-ast.h ` and :file: `Python/Python-ast.c `.
40+ * :cpy-file: `Parser/Python.asdl ` may need changes to match the grammar.
41+ Then run ``make regen-ast `` to regenerate :cpy-file: `Include/Python-ast.h `
42+ and :cpy-file: `Python/Python-ast.c `.
4243
43- * :file: `Parser/tokenizer.c ` contains the tokenization code. This is where you would
44- add a new type of comment or string literal, for example.
44+ * :cpy- file: `Parser/tokenizer.c ` contains the tokenization code.
45+ This is where you would add a new type of comment or string literal, for example.
4546
46- * :file: `Python/ast.c ` will need changes to validate AST objects involved with the
47- grammar change.
47+ * :cpy- file: `Python/ast.c ` will need changes to validate AST objects
48+ involved with the grammar change.
4849
49- * :file: `Python/ast_unparse.c ` will need changes to unparse AST objects involved with the
50- grammar change ("unparsing" is used to turn annotations into strings per :pep: `563 `).
50+ * :cpy-file: `Python/ast_unparse.c ` will need changes to unparse AST
51+ involved with the grammar change ("unparsing" is used to turn annotations
52+ into strings per :pep: `563 `).
5153
5254* The :ref: `compiler ` has its own page.
5355
54- * ``_Unparser `` in the :file: `Lib/ast.py ` file may need changes to accommodate
55- any modifications in the AST nodes.
56+ * ``_Unparser `` in the :cpy- file: `Lib/ast.py ` file may need changes
57+ to accommodate any modifications in the AST nodes.
5658
57- * :file: `Doc/library/ast.rst ` may need to be updated to reflect changes to AST nodes.
59+ * :cpy-file: `Doc/library/ast.rst ` may need to be updated to reflect changes
60+ to AST nodes.
5861
5962* Add some usage of your new syntax to ``test_grammar.py ``.
6063
6164* Certain changes may require tweaks to the library module :mod: `pyclbr `.
6265
63- * :file: `Lib/tokenize.py ` needs changes to match changes to the tokenizer.
66+ * :cpy- file: `Lib/tokenize.py ` needs changes to match changes to the tokenizer.
6467
6568* Documentation must be written! Specifically, one or more of the pages in
66- :file: `Doc/reference/ ` will need to be updated.
69+ :cpy- file: `Doc/reference/ ` will need to be updated.
0 commit comments