8
8
========
9
9
10
10
There'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.
12
12
13
13
.. note ::
14
14
These instructions are for Python 3.9 and beyond. Earlier
@@ -25,42 +25,45 @@ Checklist
25
25
26
26
Note: sometimes things mysteriously don't work. Before giving up, try ``make clean ``.
27
27
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 `.
31
31
(This runs Python's parser generator, ``Tools/peg_generator ``).
32
32
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.
39
39
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 `.
42
43
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.
45
46
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.
48
49
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 `).
51
53
52
54
* The :ref: `compiler ` has its own page.
53
55
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.
56
58
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.
58
61
59
62
* Add some usage of your new syntax to ``test_grammar.py ``.
60
63
61
64
* Certain changes may require tweaks to the library module :mod: `pyclbr `.
62
65
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.
64
67
65
68
* 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