Changes between Version 97 and Version 98 of IR


Ignore:
Timestamp:
11/30/15 09:31:30 (10 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IR

    v97 v98  
    4949Notes:
    5050* If goto is missing, default is the next location.
    51 * If guard missing, deafult is true.
     51* If guard missing, default is `true`.
    5252
    5353
     
    7373...
    7474}
    75 // etc.
    7675}}}
    7776
     
    129128* `Union[<T0, T1, ...>]`: union type, the disjoint union of `T0`, `T1`, ...
    130129* `Array[T]` : arrays of any length whose elements belong to T
    131 * `Function[<T0,T1,...>,T]` : functions consuming T0,T1,... and returning T.  T can 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.
    132131* `Mem` : type representing a memory set.  May be thought of as a set of pointers.
    133132* `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`
    135134* `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]]`
    137137
    138138Type facts:
     
    186186* `true`, `false` : literal values of type `Bool`
    187187* `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.
    189190* `implies(e1,e2)`: logical implication.  Short-circuiting.
    190191* `eq(e1,e2)`, `neq(e1,e2)`: equality/inequality test
     
    209210* `ceil(e)` : given a real or floating number, returns the least `Integer` greater than or equal to it.
    210211* `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
    214220
    215221Characters and Strings
    216222* '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`)
    218225Ranges 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.
    220228* `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,...>`
    222230
    223231Arrays (which are also Sequences)
    224232* `array(T,<e0,...,en-1>)`: value of type `Array[T, n]`, a literal array
    225233* `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.
    227236* `seq_add(a,e)` : array obtained by adding element e to the end of the array.  Original array a is not modified.
    228237* `seq_append(a1,a2)` : array obtained by concatenating two arrays.  Original array not modified.
     
    230239* `seq_insert(a,i,x)` : array obtained by inserting an element x at position i in a.
    231240* `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
    233243
    234244Tuples
     
    239249* `union_inj(U,i,x)` : `x` is in `Ti`, result is in the union type `U`
    240250* `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`.
    242252
    243253Pointers and Memory
     
    245255* `deref(e)` : pointer dereference
    246256* `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?**)
    248260* `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.
    251267* `mem_isect(mem1,mem1)` : set intersection
    252268* `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`.
    254272
    255273Scopes and Processes
     
    263281Types
    264282* `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]`.
    266285* `subtype(t1,t2)`: is `t1` a subtype of `t2`?  Both args have type `Dytype`.  Returns a `Bool`
    267286* `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`.
    269289 * 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.
    270290 * 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.
     
    278298* `sizeof_expr(e)` : the size of the value of expression `e`; return an `Integer`
    279299* `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.
    281302* `call(e0,<e1,...,en>)` : a function invocation where `e0` must evaluate to either an abstract or pure system function
    282303* `choose_int(e)` : nondeterministic choice of integer
     
    350371* `pure` : the function has no side effects, but may be nondeterministic
    351372* `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?**
    353375* `lib="..."`: function is a system function defined in specified library
    354376* `guard="...":` the name of the guard function