Changes between Version 97 and Version 98 of IR
- Timestamp:
- 11/30/15 09:31:30 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IR
v97 v98 49 49 Notes: 50 50 * If goto is missing, default is the next location. 51 * If guard missing, de afult is true.51 * If guard missing, default is `true`. 52 52 53 53 … … 73 73 ... 74 74 } 75 // etc.76 75 }}} 77 76 … … 129 128 * `Union[<T0, T1, ...>]`: union type, the disjoint union of `T0`, `T1`, ... 130 129 * `Array[T]` : arrays of any length whose elements belong to T 131 * `Function[<T0,T1,...>,T]` : functions consuming T0,T1,... and returning T. Tcan be `void` to indicate nothing is returned.130 * `Function[<T0,T1,...>,T]` : functions consuming `T0`,`T1`,... and returning `T`. `T` can be `void` to indicate nothing is returned. 132 131 * `Mem` : type representing a memory set. May be thought of as a set of pointers. 133 132 * `Pointer` : all pointers, a subtype of `Mem` 134 * `Pointer[T]` : pointer-to- T, subtype of `Pointer`133 * `Pointer[T]` : pointer-to-`T`, subtype of `Pointer` 135 134 * `Dytype` : the set of all dynamic types 136 * `Dytype[T]`: dynamic types refining T. Values of this type represent dynamic types that refine T. For example `dytype(Array[Integer,24])` has type `Dytype[Array[Integer]]` 135 * `Dytype[T]`: dynamic types refining `T`, for a static type `T`. 136 * Values of this type represent dynamic types that refine `T`. For example `dytype(Array[Integer,24])` has static type `Dytype[Array[Integer]]` 137 137 138 138 Type facts: … … 186 186 * `true`, `false` : literal values of type `Bool` 187 187 * `not(e)` : logical not 188 * `and(e1,e2)`, `or(e1,e2)`: logical and/or operation. These operators are short-circuiting, which matters because of exception side-effects. 188 * `and(e1,e2)`, `or(e1,e2)`: logical and/or operation. 189 * These operators are short-circuiting, which matters because of exception side-effects. 189 190 * `implies(e1,e2)`: logical implication. Short-circuiting. 190 191 * `eq(e1,e2)`, `neq(e1,e2)`: equality/inequality test … … 209 210 * `ceil(e)` : given a real or floating number, returns the least `Integer` greater than or equal to it. 210 211 * `abs(e)`: given any numeric expression e, returns the absolute value; result is same type as `e`. 211 * `pow(e,n)`: given any numeric expression e and expression `n` of any integral type, returns e to the n-th power. `n` must evaluate to a nonnegative integer. 212 * `herbrand(e)`: given a numeric value of type `T`, returns the value as type `Herbrand[T]`, a trivial symbolic expression consisting of a single node. 213 * `eval(e)` : given a value of type `Herbrand[T]`, returns the value of type `T` obtained by evaluating all the delayed operations 212 * `pow(e,n)`: power operator 213 * given any numeric expression e and expression `n` of any integral type, returns e to the n-th power. 214 * `n` must evaluate to a nonnegative integer. 215 * `herbrand(e)`: "Herbrandize" a numeric value. 216 * given a numeric value of type `T`, returns the value as type `Herbrand[T]`, a trivial symbolic expression consisting of a single node. 217 * `eval(e)` : evaluate a Herbrand expression 218 * given a value of type `Herbrand[T]`, returns the value of type `T` obtained by evaluating all the delayed operations 219 * exceptions may be thrown if evaluating any of the delayed operations results in an exception 214 220 215 221 Characters and Strings 216 222 * 'a', 'b', ... : Char values. **UNICODE?** 217 * `string("abc")` : string literals: value of type `Array[Char, n+1]`, where n is the length of the string (the last element is the character `\0`) 223 * `string("abc")` : string literals 224 * value of type `Array[Char, n+1]`, where `n` is the length of the string (the last element is the character `\0`) 218 225 Ranges and Domains 219 * `range(e1,e2,e3)` : value of type `Range`. If `e3` is positive, the integers e1, e1+e3, e1+2*e3, ... that are less than or equal to `e2`. If `e3` is negative, the integers e1, e1+e3, e1+2*e3, ... that are greater than or equal to `e2`. Exception if `e3` is 0. 226 * `range(e1,e2,e3)` : value of type `Range`. 227 * If `e3` is positive, the integers `e1`, `e1`+`e3`, `e1`+2*`e3`, ... that are less than or equal to `e2`. If `e3` is negative, the integers `e1`, `e1`+`e3`, `e1`+2*`e3`, ... that are greater than or equal to `e2`. Exception if `e3` is 0. 220 228 * `domain(<r1,...,rn>)` : value of type `Domain[n]`, the Cartesian product of the n ranges, with dictionary order 221 * `hasnext(dom, <i,j,…>)`: an expression of boolean type, testing if the domain `dom` contains any element after `<i,j,...>`229 * `hasnext(dom, <i,j,…>)`: an expression of type `Bool`, testing if the domain `dom` contains any element after `<i,j,...>` 222 230 223 231 Arrays (which are also Sequences) 224 232 * `array(T,<e0,...,en-1>)`: value of type `Array[T, n]`, a literal array 225 233 * `array(T,n,e)`: value of type `Array[T,n]` in which each of the n elements is `e` 226 * `asub(e1,e2)` : array subscript expression. Note that `e1` must have array type, not pointer type. (This is different from C.) If `e1` has pointer type, use `deref(padd(e1, e2))` instead. 234 * `asub(e1,e2)` : array subscript expression. 235 * Note that `e1` must have array type, not pointer type. (This is different from C.) If `e1` has pointer type, use `deref(padd(e1, e2))` instead. 227 236 * `seq_add(a,e)` : array obtained by adding element e to the end of the array. Original array a is not modified. 228 237 * `seq_append(a1,a2)` : array obtained by concatenating two arrays. Original array not modified. … … 230 239 * `seq_insert(a,i,x)` : array obtained by inserting an element x at position i in a. 231 240 * `seq_length(a)` : returns length of array a (an `Integer`) 232 * `bit_and(e1, e2)`, `bit_or(e1, e2)`, `bit_xor(e1, e2)`, `bit_comp(e1)` : bit-wise operations: arguments are arrays of booleans of equal length. 241 * `bit_and(e1, e2)`, `bit_or(e1, e2)`, `bit_xor(e1, e2)`, `bit_comp(e1)` : bit-wise operations 242 * arguments are arrays of booleans of the same length 233 243 234 244 Tuples … … 239 249 * `union_inj(U,i,x)` : `x` is in `Ti`, result is in the union type `U` 240 250 * `union_sel(U,i,y)` : `y` is in `U`, result is in `Ti` (or exception if `y` is not in image of injection from `Ti`) 241 * `union_test(U,i,y)` : `y` is in `U`; determines if `y` is in the image under injection of `Ti`. Returns a Boolean.251 * `union_test(U,i,y)` : `y` is in `U`; determines if `y` is in the image under injection of `Ti`. Returns a `Bool`. 242 252 243 253 Pointers and Memory … … 245 255 * `deref(e)` : pointer dereference 246 256 * `addr(e)` : address-of operator 247 * `padd(e1,e2)`: pointer addition. `e1` has pointer type and `e2` has an integer type or range type. If `e2` has integer type the result has pointer type. Otherwise, the result has `Mem` type. 257 * `padd(e1,e2)`: pointer addition. 258 * `e1` has pointer type and `e2` has an integer type or range type. 259 * If `e2` has integer type the result has pointer type. Otherwise, the result has `Mem` type. (**BETTER TO USE A DIFFERENT FUNCTION?**) 248 260 * `psub(e1,e2)`: pointer subtraction 249 * `mem_reach(ptr)`, where `ptr` is an expression with a pointer type. This represents the set of all memory units reachable from `ptr`, including the memory unit pointed to by `ptr` itself. 250 * `mem_union(mem1,mem2)`, where `mem1` and `mem2` are expressions of type `Memory`. This is the union of the two memory sets. 261 * Both args must have same type `Pointer[T]` for some `T`. 262 * Result has type `Integer` 263 * `mem_reach(ptr)`, where `ptr` is an expression with a pointer type. 264 * This represents the set of all memory units reachable from `ptr`, including the memory unit pointed to by `ptr` itself. 265 * `mem_union(mem1,mem2)`, where `mem1` and `mem2` are expressions of type `Memory`. 266 * This is the union of the two memory sets. 251 267 * `mem_isect(mem1,mem1)` : set intersection 252 268 * `mem_comp(mem1)` : set complement (everything not in `mem1`) 253 * `mem_slice(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`. 269 * `mem_slice(a,dom)` 270 * where `a` is an expression of array type and `dom` is an expression of `Domain` type. 271 * 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`. 254 272 255 273 Scopes and Processes … … 263 281 Types 264 282 * `new(t)` : new (default) value of `Dytype` t. If `t` has type `Dytype[T]`, then this expression has static type `T`. 265 * `typeof(e)` : returns the value of type `Dytype` representing the value type of `e`. If `e` has static type `T` then this expression has static type `Dytype[T]`. 283 * `typeof(e)` : returns the value of type `Dytype` representing the value type of `e`. 284 * If `e` has static type `T` then this expression has static type `Dytype[T]`. 266 285 * `subtype(t1,t2)`: is `t1` a subtype of `t2`? Both args have type `Dytype`. Returns a `Bool` 267 286 * `sizeof_type(t)` : the size of the dynamic type `t`; return an `Integer` 268 * `cast(e,t)` : casts `e` to a value of dytype `t`. If `t` has type `Dytype[T]`, this expression has static type `T` and the value will have dynamic type `t`. 287 * `cast(e,t)` : casts `e` to a value of dytype `t`. 288 * If `t` has type `Dytype[T]`, this expression has static type `T` and the value will have dynamic type `t`. 269 289 * A cast can only take place when there is no change to the underlying value in the concrete semantics. It is only for changing the type. 270 290 * One can cast from any integral type to another (as the values in all cases are integers), but there might be an exception if the value is not in the range of the targeted type. … … 278 298 * `sizeof_expr(e)` : the size of the value of expression `e`; return an `Integer` 279 299 * `defined(e)` : is `e` defined? `Bool` type 280 * `ite(e1,e2,e3)`: if-then-else (conditional) expression, like `e1?e2:e3` in C. `e1` must have `Bool` type. `e2` and `e3` must have the same static types, which is the static type of the result. 300 * `ite(e1,e2,e3)`: if-then-else (conditional) expression, like `e1?e2:e3` in C. 301 * `e1` must have `Bool` type. `e2` and `e3` must have the same static types, which is the static type of the result. 281 302 * `call(e0,<e1,...,en>)` : a function invocation where `e0` must evaluate to either an abstract or pure system function 282 303 * `choose_int(e)` : nondeterministic choice of integer … … 350 371 * `pure` : the function has no side effects, but may be nondeterministic 351 372 * `abstract`: function is a pure, mathematical function: deterministic function of inputs 352 * `atomic`: function definition is atomic, and it never blocks **ISN'T THIS TRUE OF EVERY SYSTEM FUNCTION? IN WHICH CASE, IS THIS ONLY FOR NON-SYSTEM FUNCTIONS?** 373 * `atomic`: function definition is atomic, and it never blocks 374 * **ISN'T THIS TRUE OF EVERY SYSTEM FUNCTION? IN WHICH CASE, IS THIS ONLY FOR NON-SYSTEM FUNCTIONS?** 353 375 * `lib="..."`: function is a system function defined in specified library 354 376 * `guard="...":` the name of the guard function
