Generate definitions with labels when translating a PlusCal algorithm
See original GitHub issueThe PlusCal translator could generate a PCOK
from the set of possible pc values that is manually added as a conjunct in a user-provided TypeOK
, and that is robust against algorithm changes:
\* BEGIN TRANSLATION
... \*
PCOK == pc \in {"lbl1", "lbl2", ..., "Done"}
\* END TRANSLATION
TypeOK ==
/\ PCOK
/\ ....
Alternatively, the translator could generate a definition with a set or even sequence of all labels.
\* BEGIN TRANSLATION
... \*
Labels == {"lbl1", "lbl2", ..., "Done"}
\* END TRANSLATION
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
A PlusCal User's Manual - P-Syntax - Leslie Lamport
PlusCal uses labels to describe the algorithm's steps. However, you can omit the labels and let the PlusCal translator add them as necessary....
Read more >ChangRoberts!TypeOK refers to non-existing PlusCal label "n2 ...
TypeOK refers to non-existing PlusCal label "n2" #34 ... Generate definitions with labels when translating a PlusCal algorithm tlaplus/tlaplus#613.
Read more >Potentially confusing behavior of a PlusCal algorithm
quickly. The basic rule is that the PlusCal translator does not expand definitions; occurrences of defined operators appear in the translation exactly as...
Read more >PlusCal / TLA : An Annotated Cheat Sheet
translator is invoked. However, TLA+ definitions may appear either before the. PlusCal algorithm or after the generated TLA+ specification.
Read more >Re: [tlaplus] Use of labels in PlusCal - Mail Thread Index
on your first question: what do you mean by "nested labels"? ... the PlusCal algorithm and the TLA+ specification that it is translated...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve never needed this feature in my work, but I can see how it would be useful. Three quick comments:
I agree with @muenchnerkindl; legal PC values should be separated by process ID.
Between
Labels
andPCOK
:Labels
seems more generic and useful to me.Although, rather than
Labels
, I would use a very long and descriptive name likePossiblePCValuesByProcessID
. This is (1) self-documenting and (2) less likely to clash with identifiers in existing PlusCal modules.I think it would be nice to have, but in practice it would rather be something like
(and even more complicated for Distributed PlusCal if we ever get to release it).