Skip to content
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

Define built-ins contexts (for Yul built-in functions) and synthetically build the stack graph for the built-ins #1203

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

ggiraldez
Copy link
Contributor

@ggiraldez ggiraldez commented Dec 24, 2024

This PR introduces several changes to how built-ins are defined and processed. We define different built-in contexts to separate built-in symbols available in Solidity and Yul. Also, the part of the stack graph that contains all definitions of built-ins is now built directly into the stack graph, without generating a Solidity file and the processing it as a system file. This allows much faster initialization of the Bindings Graph and most symbol mangling is no longer needed since we're not required to parse the built-ins file anymore.

In addition, all Yul built-ins are no longer defined in the grammar as special keywords and instead are treated as normal identifiers and bound to built-in definitions using the regular binding rules.

NB: I'm not totally happy with how the code to build the built-ins stack graph is being generated (with Rust), but I took a stab at using Jinja templates for it and the partial results were getting comparatively too complicated.

Copy link

changeset-bot bot commented Dec 24, 2024

⚠️ No Changeset found

Latest commit: 3dac60f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ggiraldez ggiraldez changed the title Allow defining built-ins types and functions only inside relevant contexts Define built-ins contexts (for Yul built-in functions) and synthetically build the stack graph for the built-ins Feb 5, 2025
@ggiraldez ggiraldez marked this pull request as ready for review February 5, 2025 06:50
@ggiraldez ggiraldez requested review from a team as code owners February 5, 2025 06:50
@mjoerussell mjoerussell removed their assignment Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants