Changes between Version 37 and Version 38 of Language


Ignore:
Timestamp:
05/21/23 10:26:43 (3 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Language

    v37 v38  
    341341
    342342A `$choose` statement has the form
     343  `$choose` `{` ''stmt''+ ( `default` `:` ''stmt'' )? `}`
     344For example,
     345
    343346{{{
    344347$choose {
    345   stmt1;
    346   stmt2;
    347   ...
    348   default: stmt
     348  $when (x<n) x++;
     349  $when (s>0) s--;
     350  $default: c++;
    349351}
    350352}}}
    351353The default clause is optional.
     354
    352355The guards of the statements are evaluated and among those that are true, one is chosen nondeterministically and executed.
    353356If none are true and the default clause is present, it is chosen.
     
    417420
    418421A guarded command is encoded in CIVL-C using a `$when` statement:
    419 {{{
    420 $when (expr) stmt;
    421 }}}
    422 All statements have a guard, either implicit or explicit. For most statements, the guard is ''true''.
     422  `$when` `(` ''expr'' `)` ''stmt''
     423
     424Semantics: all CIVL-C statements have a guard, either implicit or explicit, which specifies when the statement is enabled.
     425For most statements (e.g., assignments), the guard is implicitly ''true''.
    423426The `$when` statement allows one to attach an explicit guard to a statement.
    424427
    425 When `expr` is ''true'', the statement is enabled, otherwise it is disabled.
     428At a state in which the guard evaluates to ''true'', the statement is enabled, otherwise it is disabled.
    426429A disabled statement is blocked—it will not be scheduled for execution.
    427 When it is enabled, it may execute by moving control to the `stmt` and executing the first atomic action in the `stmt`.
    428 If `stmt` itself has a non-trivial guard, the guard of the `$when` statement is the conjunction of the `expr` and the guard of `stmt`.
    429 
    430 The evaluation of `expr` and the first atomic action of `stmt` occur as a single atomic action.
    431 There is no guarantee that execution of `stmt` will continue atomically if it contains more than one atomic action, i.e., other processes may be scheduled.
     430When a `$when` statement is enabled and scheduled for execution, it executes by moving control to ''stmt'' and executing the first atomic action in ''stmt''.
     431
     432If ''stmt'' itself has a non-trivial guard, the guard of the `$when` statement is the conjunction of ''expr'' and the guard of ''stmt''.
     433
     434The evaluation of ''expr'' and the first atomic action of ''stmt'' occur as a single atomic action.
     435There is no guarantee that execution of ''stmt'' will continue atomically if it contains more than one atomic action, i.e., other processes may be scheduled.
    432436
    433437==== Example