FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-131498: Cases generator: Parse down to C statement level. by markshannon · Pull Request #131948 · python/cpython · GitHub

Repository navigation

GH-131498: Cases generator: Parse down to C statement level. - #131948

Merged
markshannon merged 14 commits into
python:mainfrom
faster-cpython:code-gen-add-parser
Apr 2, 2025
Merged

markshannon merged 14 commits into
python:mainfrom
faster-cpython:code-gen-add-parser

Conversation

markshannon commented Mar 31, 2025 •
edited
Loading

Copy link
Copy Markdown
Member

This PR enhances the cases generator parser to parse instructions and labels down to C statement level.

This:

  • Simplifies the rest of the code generator.
  • Enables us to treat #if conditionals like normal if statements ensuring that the free-threading and default builds have the same properties and are properly understood by the code generator.

Because we are now parsing the source, rather than simply tokenizing it, the output no longer contains the comments present in the original.

Comment thread Tools/cases_generator/parsing.py Outdated
raise NotImplementedError()


@dataclass

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe to reduce memory footprint, use slots=True

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't think it is worth it to save a few kbytes.

Comment thread Tools/cases_generator/parsing.py Outdated
Comment thread Tools/cases_generator/parsing.py Outdated
markshannon marked this pull request as ready for review April 2, 2025 13:57
markshannon merged commit ad053d8 into python:main Apr 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL