Changes between Version 16 and Version 17 of PIL
- Timestamp:
- 10/06/24 09:30:04 (19 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PIL
v16 v17 35 35 * `$int[]* q`: pointer to array of integer 36 36 * `$int*[]($real) f`: function from Real to array of pointer to integer 37 - every type has a default value. The result of evaluating an erroneous expression is the default value of that type. 37 38 - basic types: 38 * `$bool` : the set consisting of `$true` and `$false` 39 * `$int`: the set of integers 40 * `$real`: the set of Reals 41 * `$int< lo,hi>`: set of integers between `lo` and `hi`, inclusive. `lo` and `hi` are constant expressions so are known at compile time.42 * `$uint<hi>`: nonnegative integers less than the constant expression `hi`. Arithmetic is performed modulo `hi` (like C's unsigned integer types). 43 * `$float<p,emax>`: the set of IEEE binary floating point numbers with precision `p` and emax `emax`. These are also constant expressions. 44 - `T*`: pointer to `T` 45 - `struct TAG { T1 f1; ... Tn fn; }`: a C struct 46 - `union`: similar47 - `T[]`: sequence of `T`. Note: there is no "T[n]". Sequences are first-class values: they can be assigned, returned, passed as arguments, etc. 48 - `R(T1, ..., Tn)`: the type of a procedure which consumes values in `T1`, ..., `Tn` and returns a value in `R`. This is basically C's function type. 49 - `$fun<T1,T2>` : "logic functions": deterministic, total, side-effect free functions from `T1` to `T2`. Note however the function may depend on the state (i.e., the state should be considered a hidden input). A `$pure` function is a function that does not depend on the state. 50 - `$set<T>` : finite set of `T` 51 - `$map<T1,T2>` : finite map from `T1` to `T2`. A map is a set of ordered pairs `(x,y)` with the property that if `(x,y)` and `(x,z)` are in the map, then `y`=`z`. 52 - `$tuple<T1,...>` : tuples of specified type. This is similar to `struct`, but there is no tag and the fields do not have names. 39 * `$bool` : the set consisting of `$true` and `$false`. Default value: `$false`. 40 * `$int`: the set of integers. Default value: 0. 41 * `$real`: the set of Reals. Default value: 0.0. 42 * `$int<max>`: set of integers [-max, max-1]. `max` is a constant positive integer expression so is statically known. Default value: 0. 43 * `$uint<hi>`: nonnegative integers less than the constant expression `hi`. Arithmetic is performed modulo `hi` (like C's unsigned integer types). Default value: 0. 44 * `$float<p,emax>`: the set of IEEE binary floating point numbers with precision `p` and emax `emax`. These are also constant expressions. Default value: 0.0. 45 - `T*`: pointer to `T`. Default value: `NULL`. 46 - `struct TAG { T1 f1; ... Tn fn; }`: a C struct. Default value: the struct value in which each field has its default value. 47 - `union`: a C union. Default value: the union value in which the first field has its default value. 48 - `T[]`: sequence of `T`. Note: there is no "T[n]". Sequences are first-class values: they can be assigned, returned, passed as arguments, etc. Default value: the sequence of length 0. 49 - `R(T1, ..., Tn)`: the type of a procedure which consumes values in `T1`, ..., `Tn` and returns a value in `R`. This is basically C's function type. Default value: the procedure which does nothing (has no side-effects) and returns the default value of `R` for any inputs. 50 - `$fun<T1,T2>` : "logic functions": deterministic, total, side-effect free functions from `T1` to `T2`. Note however the function may depend on the state (i.e., the state should be considered a hidden input). A `$pure` function is a function that does not depend on the state. Default value: the function that returns the default value of `T2` on any input. 51 - `$set<T>` : finite set of `T`. Default value: the empty set. 52 - `$map<T1,T2>` : finite map from `T1` to `T2`. A map is a set of ordered pairs `(x,y)` with the property that if `(x,y)` and `(x,z)` are in the map, then `y`=`z`. Default value: the empty map. 53 - `$tuple<T1,...>` : tuples of specified type. This is similar to `struct`, but there is no tag and the fields do not have names. Default value: the tuple in which each component has its default value. 53 54 - Type definitions have the form: `typedef typename ID;` 54 55 … … 158 159 * the two tuples have the same type and corresponding components are equal 159 160 - `t.(i)` 160 * the value of component `i` (a constant integer) of tuple `t`161 * the value of component `i` (an integer constant) of tuple `t`. Syntax error if `i` is out of range for the tuple type. 161 162 - `($tuple<T1,...>){ expr1, ... }` 162 163 * the literal tuple with the given list of components. 163 164 - `t[.(i) := expr1]` 164 * the tuple which is the same as `t`, except for component `i` (a constant integer), which has value `expr1`165 * the tuple which is the same as `t`, except for component `i` (an integer constant), which has value `expr1`. Syntax error if `i` is out of range. 165 166 166 167 Mutating expressions: 167 - `t.(i) = expr` : sets component `i` of tuple `t` to `expr` 168 - `t.(i) = expr` : sets component `i` of tuple `t` to `expr`. Here `i` is an integer constant; it is a syntax error if `i` is out of range. 168 169 169 170 == Sets … … 199 200 Mutating procedures: 200 201 - `$bool $set_add($set<T> * this, T x);` 202 * adds `x` to `this`. Returns `$true` iff `x` was not in `this`, i.e., if the operation results in a change to the set. 201 203 - `$bool $set_remove($set<T> * this, T x);` 204 * removes `x` from `this`. Returns `$true` iff `x` was in `this`, i.e., if the operation results in a change to the set. 202 205 - `void $set_addAll($set<T> * this, $set<T> that);` 206 * adds all of the elements of `that` to `this` 203 207 - `void $set_removeAll($set<T> * this, $set<T> that);` 208 * removes all of the elements of `that` from `this` 204 209 - `void $set_keepOnly($set<T> * this, $set<T> that);` 210 * removes any elements of `this` which is not in `that` from `this` 205 211 206 212 == Sequences (arrays) … … 210 216 * the two sequences have the same type and length and corresponding elements are equal 211 217 - `a[i]` 212 * the `i`-th element of `a`. Here `a` is an expression of type `T[]` and `i` is an expression of type `$int`. 218 * the `i`-th element of `a`. Here `a` is an expression of type `T[]` and `i` is an expression of type `$int`. Requires `i` to be in range, i.e., `i` is in [0,n-1], where n is the length of `a`. (Otherwise the expression is erroneous.) 213 219 - `a[i:=x]` 214 * the sequence which is the same as `a`, except in position `i`, where it has value `x`. Here `a` is an expression of type `T[]`, `i` is an expression of type `$int`, and `x` is an expression of type `T` 220 * the sequence which is the same as `a`, except in position `i`, where it has value `x`. Here `a` is an expression of type `T[]`, `i` is an expression of type `$int`, and `x` is an expression of type `T`. Requires `i` to be in range for `a`. 215 221 - `(T[]){ expr1, ... }` 216 222 * the sequence obtained by evaluating the given expressions, each of which has type `T` … … 224 230 * the length of `a` 225 231 - `$pure $logic T[] $seq_subseq(T[] a, int i, int n);` 226 * the sequence of length n, a[i..i+n-1] 232 * the sequence of length n, a[i..i+n-1]. Requires that i..i+n-1 are all in range for `a` 227 233 - $pure $logic T[] $seq_with(T[] a, int i, T x);` 228 * the sequence obtained from `a` by inserting `x` at position `i` and shifting the subsequent elements up 229 - `$pure $logic T[] $seq_without(T[] a, int i);` 234 * the sequence obtained from `a` by inserting `x` at position `i` and shifting the subsequent elements up. Requires `i` to be in [0,n], where `n` is the length of `a`. 235 - `$pure $logic T[] $seq_without(T[] a, int i);`. Requires `i` to be in [0,n-1], where `n` is the length of `a`. 230 236 * the sequence obtained from `a` by deleting the element in position `i` and shifting subsequent elements down 231 237 - `$pure $logic T[] $seq_concat(T[] a1, T[] a2);`
