CN: Add the ability to refer to resources by name - #921
Draft
dc-mak wants to merge 3 commits into
Draft
Conversation
This commit is the first in a series to address rems-project#311, by allowing users to name the (quantified) resource they want to focus on. The precise syntax will probably change in response to user feedback, but right now it is `take <sym> = <resource> as <sym'>;` where "as" is a new keyword and "<sym'>" is a symbol. At this point, the latter part is optional, to preserve backwards compatibility. Only quantified predicates really _need_ names, but to forbid names on regular resources grammatically seems overly restrictive, so we shall see how that plays out. A tentative plan for how names evolve is: |--------------------------|-----------| | Owned<struct s>(..) as H | H.<field> | | Owned<ct[10]> as H | H[<index> | | focus H[<var>]; | H[<var>] | | focus H[<expr>] as H' | H' | | partial consumption | H | | unfold a user-def pred | H.<names> | Also need a way of naming the ensures of a function call. I believe there is no need to consider generating names for predicate folds because that will only happen on demand at an ensures or preceding a function call. Perhaps the "names" of the resources in the context actually need to be terms, e.g. to deal smoothly with H[<expr>].
This commit adds support in the parser and Cabs to having a single magic comment at the end of an call expression. It still needs to be pretty-printed as well as translated into correct/useful Ail.
Collaborator
Author
|
Better to split into separate PRs:
Given that there are already usable symbols for this, will be easier to try a |
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To fix #311. Experimental.