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

[Civl] Anonymous actions in refinement specification of yield procedures #972

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

shazqadeer
Copy link
Contributor

@shazqadeer shazqadeer commented Oct 23, 2024

It is occasionally tedious to invent names of atomic actions whose only purpose is to serve as refinement specification of a yield procedure. This PR enables such specifications to be specified via anonymous actions. The new test file added in this PR provides a good illustration.

@shazqadeer shazqadeer merged commit 35ed12b into master Oct 24, 2024
5 checks passed
@menesro
Copy link
Collaborator

menesro commented Oct 24, 2024

Yes, I like it. It is also easier to read the file because the atomic specification is close to the yield procedure.

Copy link
Member

@bkragl bkragl left a comment

Choose a reason for hiding this comment

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

Nice feature! Combines the convenience of the original Civl implementation with the flexibility of named actions.

right action {:layer 1, 9} Atomic_Mutex_Alloc() returns ({:linear} one_loc_l: One Loc)
modifies MutexPool;
yield procedure {:layer 0} Mutex_Alloc() returns ({:linear} one_loc_l: One Loc);
refines right action {:layer 1, 9} _
Copy link
Member

Choose a reason for hiding this comment

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

How hard would it be to eliminate the name from the grammar in the anonymous case? My understanding is that anything can be put, which might be confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is so hard that I don't even know how to do it right now :-). The problem is that I need to allow attributes as well as the action body both of which begin with {. Take a look at BoogiePL.atg when you find some time. In any case, the convention of using _ for the name of the anonymous action feels nice to me.

@shazqadeer
Copy link
Contributor Author

The current behavior is that the name of the anonymous action could be an arbitrary string (including _) but it is thrown away and an internally generated name is used. There is one other option: use the supplied name if it is different from _ but generate an internal name if it is _.

Any preference?

@bkragl
Copy link
Member

bkragl commented Nov 2, 2024

There is one other option: use the supplied name if it is different from _ but generate an internal name if it is _.

This sounds like a good solution to me that will avoids potential confusion. _ is commonly used for anonymous things in programming languages, and being allowed to refer to the action as if it were declared separately seems reasonable.

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.

3 participants