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

bs-classic: Swap the precedence level of := and $ #566

Merged
merged 4 commits into from
Jul 28, 2023

Conversation

rossc719g
Copy link
Contributor

@rossc719g rossc719g commented Jun 23, 2023

In bluespec classic, this allows $ to be used on either side of a :=.
It should not have any impact on bluespec verilog, where $ is not a valid operator (AFAIK).

E.g., something like this would be syntactically legal:
select foo $ f1 a := map f2 $ map f3 v

Wanting to use $ on the lhs of an assignment is probably uncommon, but the rhs is more sensible.
E.g., something like:
foo := map f $ map g v
is currently an error, because, it would try to pass map g v as an argument to foo := map f, which is not the intention.
I think the result of a := is always Action which can't take an argument, so I do not believe the existing behavior needs to be preserved.

Alternatives that might be worth considering:
Setting both operators to the same precedence level works to allow $ on the rhs of :=.
It feels more natural to me to swap them though.

Charlie Ross added 2 commits June 23, 2023 12:32
This allows `$` to be used on either side of a `:=`.

E.g., something like:
select foo $ f1 a := map f2 $ map f3 v

Using `$` on the lhs of an assignment is pretty niche, but the rhs is
more sensible.
@quark17 quark17 merged commit 3fa71b6 into B-Lang-org:main Jul 28, 2023
28 checks passed
@quark17
Copy link
Collaborator

quark17 commented Jul 28, 2023

Thank you for contributing this PR!

@rossc719g rossc719g deleted the precedence branch July 28, 2023 22:41
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