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

Add support for scopes #37

Open
asl opened this issue Jan 27, 2025 · 1 comment · May be fixed by #42
Open

Add support for scopes #37

asl opened this issue Jan 27, 2025 · 1 comment · May be fixed by #42
Assignees

Comments

@asl
Copy link
Collaborator

asl commented Jan 27, 2025

Implement BlockStatement

@asl asl self-assigned this Jan 27, 2025
@asl
Copy link
Collaborator Author

asl commented Jan 27, 2025

One thing to note here: we need to allow scopes to return a value. While there are not so many places in P4 language where we can expect values to be returned from entire scopes, it would help to:

  • Implement shortcut semantics of && / || (essentially, we can just transform them to something similar to C/C++ cond ? : true : false operator in order not to lower to explicit control flow earlier
  • Simplify inlining (no need to to do some special logic for result copy out: just inline the whole outer scope and replace return with yield)
  • Simplify loop iteration variable handling (just have loop header scope to yield new index value each time).
  • ...

@asl asl linked a pull request Jan 27, 2025 that will close this issue
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 a pull request may close this issue.

1 participant