Changes between Version 3 and Version 4 of Language


Ignore:
Timestamp:
05/17/23 21:22:41 (3 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Language

    v3 v4  
    244244== Statements
    245245
    246 === `$atomic`
     246=== Atomic blocks: `$atomic`
    247247
    248248An ''atomic block'' is a statement of the form
     
    279279Execution of a `$yield` does not change the multiplicity; the process releases the lock but maintains the multiplicity, so that when the lock is re-obtained, the original multiplicity is still in place.
    280280
    281 === `$choose`
     281=== Nondeterministic selection statement `$choose`
     282
     283A `$choose` statement has the form
     284{{{
     285$choose {
     286  stmt1;
     287  stmt2;
     288  ...
     289  default: stmt
     290}
     291}}}
     292The default clause is optional.
     293The guards of the statements are evaluated and among those that are true, one is chosen nondeterministically and executed.
     294If none are true and the default clause is present, it is chosen.
     295The default clause will only be selected if all guards are false.
     296If no default clause is present and all guards are false, the statement blocks.
     297Hence the implicit guard of the `$choose` statement without a default clause is the disjunction of the guards of its sub-statements.
     298The implicit guard of the `$choose` statement with a default clause is ''true''.
     299
     300Example: this shows how to encode a “low-level” guarded transition system:
     301{{{
     302l1:
     303$choose {
     304  $when (x>0) {x--; goto l2;}
     305  $when (x==0) {y=1; goto l3;}
     306  default: {z=1; goto l4;}
     307}
     308l2:
     309$choose {
     310  ...
     311}
     312l3:
     313$choose {
     314  ...
     315}
     316}}}
    282317
    283318=== `$for`