Skip to content

Fix remaining broken links. #1013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions developer-workflow/grammar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@ Note: sometimes things mysteriously don't work. Before giving up, try ``make cl
* :cpy-file:`Grammar/python.gram`: The grammar, with actions that build AST nodes.
After changing it, run ``make regen-pegen`` (or ``build.bat --regen`` on Windows),
to regenerate :cpy-file:`Parser/parser.c`.
(This runs Python's parser generator, ``Tools/peg_generator``).
(This runs Python's parser generator, :cpy-file:`Tools/peg_generator`).

* :cpy-file:`Grammar/Tokens` is a place for adding new token types. After
changing it, run ``make regen-token`` to regenerate :cpy-file:`Include/token.h`,
:cpy-file:`Parser/token.c`, :cpy-file:`Lib/token.py` and
:cpy-file:`Doc/library/token-list.inc`. If you change both ``python.gram``
and ``Tokens``, run ``make regen-token`` before ``make regen-pegen``.
changing it, run ``make regen-token`` to regenerate
:cpy-file:`Include/internal/pycore_token.h`, :cpy-file:`Parser/token.c`,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include/token.h was renamed to Include/internal/pycore_token.h (the rest is paragraph reflow).

:cpy-file:`Lib/token.py` and :cpy-file:`Doc/library/token-list.inc`.
If you change both ``python.gram`` and ``Tokens``,
run ``make regen-token`` before ``make regen-pegen``.
On Windows, ``build.bat --regen`` will regenerate both at the same time.

* :cpy-file:`Parser/Python.asdl` may need changes to match the grammar.
Then run ``make regen-ast`` to regenerate :cpy-file:`Include/Python-ast.h`
and :cpy-file:`Python/Python-ast.c`.
Then run ``make regen-ast`` to regenerate
:cpy-file:`Include/internal/pycore_ast.h` and :cpy-file:`Python/Python-ast.c`.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include/Python-ast.h was moved to Include/internal/pycore_ast.h.


* :cpy-file:`Parser/tokenizer.c` contains the tokenization code.
This is where you would add a new type of comment or string literal, for example.
Expand Down
13 changes: 5 additions & 8 deletions internals/compiler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ Finally, you need to introduce the use of the new bytecode. Altering
places to change. You must add the case for a new opcode into the 'switch'
statement in the ``stack_effect()`` function in :cpy-file:`Python/compile.c`.
If the new opcode has a jump target, you will need to update macros and
'switch' statements in :cpy-file:`Python/peephole.c`. If it affects a control
'switch' statements in :cpy-file:`Python/compile.c`. If it affects a control
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The relevant code was apparently moved into Python/compile.c in python/cpython#21517.

flow or the block stack, you may have to update the ``frame_setlineno()``
function in :cpy-file:`Objects/frameobject.c`. :cpy-file:`Lib/dis.py` may need
an update if the new opcode interprets its argument in a special way (like
Expand All @@ -514,7 +514,8 @@ Code Objects
============

The result of ``PyAST_CompileObject()`` is a ``PyCodeObject`` which is defined in
:cpy-file:`Include/code.h`. And with that you now have executable Python bytecode!
:cpy-file:`Include/cpython/code.h`. And with that you now have executable
Python bytecode!

The code objects (byte code) are executed in :cpy-file:`Python/ceval.c`. This file
will also need a new case statement for the new opcode in the big switch
Expand Down Expand Up @@ -579,18 +580,14 @@ Important Files

* :cpy-file:`Python/symtable.c`: Generates a symbol table from AST.

* :cpy-file:`Python/peephole.c`: Optimizes the bytecode.

* :cpy-file:`Python/pyarena.c`: Implementation of the arena memory manager.

* :cpy-file:`Python/wordcode_helpers.h`: Helpers for generating bytecode.
Comment on lines -582 to -586
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both got merged into Python/compile.c, which is already listed above, so I removed these.


* :cpy-file:`Python/opcode_targets.h`: One of the files that must be
modified if :cpy-file:`Lib/opcode.py` is.

* :cpy-file:`Include/`
* :cpy-file:`Include/code.h`: Header file for :cpy-file:`Objects/codeobject.c`;
contains definition of ``PyCodeObject``.
* :cpy-file:`Include/cpython/code.h`: Header file for
:cpy-file:`Objects/codeobject.c`; contains definition of ``PyCodeObject``.

* :cpy-file:`Include/opcode.h`: One of the files that must be modified if
:cpy-file:`Lib/opcode.py` is.
Expand Down