Changes between Version 94 and Version 95 of IR


Ignore:
Timestamp:
11/30/15 08:58:57 (10 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IR

    v94 v95  
    188188* 123, -123, 3.1415, etc. : values of type `Integer`, `Int`, `Real`, `Float`.   **NEED TO BE MORE SPECIFIC**
    189189* `add(e1,e2)` : numeric addition. 
    190  * `e1` and `e2` have the same numeric type.  Note that there are no "automatic conversions" as there are in C.  If the original expressions have different types, explicit casts must be inserted. 
     190 * `e1` and `e2` have the same numeric type.  Note that there are no "automatic conversions" as there are in C.  If the original expressions have different types, explicit conversions must be inserted. 
    191191* `sub(e1,e2)` : subtraction
    192192* `mul(e1,e2)` : multiplication
     
    254254* `scope_lte(e1,e2)`: is first scope a subscope or equal to second?
    255255
     256Types
     257* `new(t)` : new (default) value of `Dytype` t.  If `t` has type `Dytype[T]`, then this expression has static type `T`.
     258* `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]`.
     259* `subtype(t1,t2)`: is `t1` a subtype of `t2`?  Both args have type `Dytype`.  Returns a `Bool`
     260* `sizeof_type(t)` : the size of the dynamic type `t`; return an `Integer`
     261* `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`.
     262 * 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.
     263 * 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.
     264 * One can cast any `Float` value to a `Real` value, but not the other way.  (To convert from a `Real` to a `Float`, use, e.g., `round`.)
     265 * One cannot cast from one `Float` type to another `Float` type (unless the float parameters are exactly the same).  To do this, one could instead use `round`.
     266 * If `t1` is a subtype of `t2`, one can always cast from `t1` to `t2` (though this is rarely necessary, since an expression of type `t1` can be used wherever one of type `t2` is expected).  One can also cast from `t2` to `t1`, but a runtime exception will be thrown if the value being cast does not already belong to `t1`.  For example, one might cast from `Domain` to `Domain[n]`, or from `Array[Real]` to `Array[Real, n]`.
     267 * One cannot cast between a Herbrand type and any other type.  Instead, use functions `eval` and `herbrand`.
     268
    256269Other expressions
    257270* `"x"` : x is an identifier, naming either a type, variable, or function
    258 * `subtype(e1,e2)`: is `e1` a subtype of `e2`?  Both args have type `Dytype`.
    259 * `sizeof_type(t)` : the size of the dynamic type t; `Integer` type
    260 * `sizeof_expr(e)` : the size of the value of expression `e`; `Integer` type
    261 * `new(t)` : new (default) value of `Dytype` t
     271* `sizeof_expr(e)` : the size of the value of expression `e`; return an `Integer`
    262272* `defined(e)` : is `e` defined? `Bool` type
    263 * `cast(e,T)` : casts `e` to a value of the named type.
    264  * 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.
    265  * 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.
    266  * One can cast any `Float` value to a `Real` value, but not the other way.  (To convert from a `Real` to a `Float`, use, e.g., `round`.)  One cannot cast from one `Float` type to another `Float` type (unless the float parameters are exactly the same).  To do this, one could instead use `round`.
    267  * If t1 is a subtype of t2, one can always cast from t1 to t2 (though this is rarely necessary, since an expression of type t1 can be used wherever one of type t2 is expected).  One can also cast from t2 to t1, but a runtime exception will be thrown if the value being cast does not already belong to t1.  For example, one might cast from `Domain` to `Domain[n]`, or from `Array[Real]` to `Array[Real, n]`.
    268  * One cannot cast between a Herbrand type and any other type.  Instead, use functions `eval` and `herbrand`.
    269 * `ite(e1,e2,e3)`: if-then-else (conditional) expression, like `e1?e2:e3` in C.
     273* `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.
    270274* `call(e0,<e1,...,en>)` : a function invocation where `e0` must evaluate to either an abstract or pure system function
    271275* `choose_int(e)` : nondeterministic choice of integer
     
    282286* `WAITALL e, n;` where `e` is a pointer to a process reference and `n` is the number of processes to be waited for
    283287* `ALLOCATE e, h, t, e0;`
    284  * `e` has type `Pointer`
     288 * `e` has static type `Pointer[T]`, for some static type `T`
    285289 * `h` has type `Heap`
    286  * `t` has type `Dytype`
    287  * `e0` has integer type.
    288  * Allocates `e0` objects of type `t` on heap `h`, returning pointer to first element in `e`
     290 * `t` has type `Dytype[T]`, for the same static type `T`
     291 * `e0` has an integral type.
     292 * Allocates `e0` objects of type `t` on heap `h`, returning pointer to first element in `e`.  **WOULD IT BE BETTER TO SPECIFY THE SCOPE?**
    289293 * To translate the C `malloc` you first need to figure out the type of the elements being malloced.  If the argument to malloc is `n`, then you first need to insert an assertion `eq(mod(n, sizeof_type(t)), 0)`, and then `ALLOCATE e, h, t, div(n, sizeof_type(t))`.
    290294* `FREE p;`