Changes between Version 23 and Version 24 of ContractReduction
- Timestamp:
- 12/07/15 11:38:07 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ContractReduction
v23 v24 1 1 == Contract Reduction Language == 2 3 == ACSL function contract grammar with CIVL-C extension (in bold) == 4 5 `function-contract ::= requires-clause∗ terminates-clause? decreases-clause?` 6 `simple-clause∗ named-behavior∗ completeness-clause∗` 7 8 `requires-clause ::= requires pred ;` 9 10 `terminates-clause ::= terminates pred ;` 11 12 `decreases-clause ::= decreases term (for id)? ;` 13 14 `simple-clause ::= assigns-clause | ensures-clause | allocation-clause | abrupt-clause-fn` 15 16 `assigns-clause ::= assigns locations ;` 17 18 `locations ::= location (, location) ∗ | \nothing |` **\everything** 19 20 `location ::= tset` 21 22 `ensures-clause ::= ensures pred ;` 23 24 `named-behavior ::= behavior id : behavior-body` 25 26 `behavior-body ::= assumes-clause∗ requires-clause∗ simple-clause∗` 27 28 `assumes-clause ::= assumes pred ;` 29 30 `completeness-clause ::= complete behaviors (id (, id)∗)? ;` 31 `| disjoint behaviors (id (, id)∗)? ;` 32 33 {{{ 34 tset ::= \empty 35 | tset -> id 36 | tset . id * tset 37 | & tset 38 | tset [ tset ] 39 | term? .. term? 40 | \union ( tset (, tset)∗ ) 41 | \inter ( tset (, tset)∗ ) 42 | tset + tset 43 | ( tset ) 44 | { tset | binders (; pred)? } 45 | { term } term 46 }}} 47 48 `term ::= \old ( term ) | \result` 49 50 `pred ::= \old ( pred )` 2 51 3 52 4 53 == `$memory` type == 5 54 6 The new built-in type `$memory` denotes a set of memory units . The following expressions have type `$memory`:55 The new built-in type `$memory` denotes a set of memory units (aka., memory locations). The following expressions have type `$memory`: 7 56 * a left-hand-side expression, when used in certain contexts, is automatically converted to `$memory`. The contexts are: arguments to the built-in functions `$access`, `$read`, and `$write` described below, or occurrence in the list of an `$assigns` clause 8 57 * `a[dom]`, where `a` is an expression of array type and `dom` is an expression of `$domain` type. The dimension of the array must match the dimension of the domain. This represents all memory units which are the cells in the array indexed by a tuple in `dom`. … … 11 60 [[* `mem1+mem2`, where `mem1` and `mem2` are expressions of type `$memory`. This is the union of the two sets.]] Problem this is ambiguous with numeric +, as in x+y. 12 61 13 == ` $assigns` clause ==62 == `assigns` clause == 14 63 15 64 As in other contract specification language, this contract clause is used to specify a set of existing memory units. The claim is that if an existing memory unit is not in the set, it will not be modified in the course of the function call. The syntax is: 16 {{{ 17 $assigns {<memory-list>} 18 }}} 65 `assigns location (, location)*` or `assigns \nothing` 66 19 67 where `<memory-list>` is a comma-separated list of expressions of type `$memory`. 20 68 21 69 Example: 22 70 {{{ 23 $assigns x,a[i][j],$region(list->head),b[dom];71 assigns x,a[i][j],$region(list->head),b[dom]; 24 72 }}} 25 73
