Changes between Version 65 and Version 66 of IR
- Timestamp:
- 11/25/15 21:38:55 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IR
v65 v66 130 130 131 131 L0: 132 when (\true) assignn, 10; goto L1;132 when (\true) ASSIGN n, 10; goto L1; 133 133 L1: 134 when (\true) assignS_d, \dytype(Tuple[<Array[Integer, n]]>); goto L2;134 when (\true) ASSIGN S_d, \dytype(Tuple[<Array[Integer, n]]>); goto L2; 135 135 L2: 136 when (\true) assignx1, \new(S_d); goto L3;136 when (\true) ASSIGN x1, \new(S_d); goto L3; 137 137 L3: 138 when (\true) assignn, 20; goto L4;138 when (\true) ASSIGN n, 20; goto L4; 139 139 L4: 140 when (\true) assignx2, \new(S_d); goto L5;140 when (\true) ASSIGN x2, \new(S_d); goto L5; 141 141 L5: 142 142 }}} … … 150 150 * `\true`, `\false` : literal values of type `Bool` 151 151 * `\not(e)` : logical not 152 * `\and(e1, e2)`, `\or(e1, e2)`: logical and/or operation 153 * `\eq(e1, e2)`, `\neq(e1, e2)`: equality/inequality test 154 * `\forall <i1:T1, i2:T2, ...>, e1, e2` : universal quantification. For all i1 in type T1, i2 in type T2, ...: if e1 holds, then e2 holds. The only reason for having two expressions e1 and e2 is possible side-effects (exceptions) in e2 if e1 does not hold. For example, e1 can be x!=0, and e2 can safely divide by 0. 155 * `\exists <i1:T1, i2:T2, ...>, e1, e2`: existential quantification. There is some i1 in type T1, i2 in type T2, ..., such that e1 holds and e2 holds. 152 * `\and(e1,e2)`, `\or(e1,e2)`: logical and/or operation. These operators are short-circuiting, which matters because of exception side-effects. 153 * `\implies(e1,e2)`: logical implication. Short-circuiting. 154 * `\eq(e1,e2)`, `\neq(e1,e2)`: equality/inequality test 155 * `\forall <i1:T1,i2:T2,...>, e` : universal quantification. For all i1 in type T1, i2 in type T2, ..., e2 holds. 156 * `\exists <i1:T1,i2:T2,...>, e`: existential quantification. There is some i1 in type T1, i2 in type T2, ..., such that e holds. 156 157 Numeric 157 158 * 123, -123, 3.1415, etc. : values of type `Integer`, `Int`, `Real`, `Float`. **NEED TO BE MORE SPECIFIC** 158 * `\add(e1, e2)` : numeric addition.159 * `\add(e1,e2)` : numeric addition. 159 160 * `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. 160 * `\sub(e1, e2)` : subtraction161 * `\mul(e1, e2)` : multiplication162 * `\div(e1, e2)` : division161 * `\sub(e1,e2)` : subtraction 162 * `\mul(e1,e2)` : multiplication 163 * `\div(e1,e2)` : division 163 164 * If both are integer types, the result is integer division. Otherwise it is real division. Need to define what happens for negative integers. 164 * `\mod(e1, e2)` : integer modulus165 * `\mod(e1,e2)` : integer modulus 165 166 * `\neg(e)` : negative 166 * `\lt(e1, e2)`, `\lte(e1,e2)`: less than/less than or equal to167 * `\lt(e1,e2)`, `\lte(e1,e2)`: less than/less than or equal to 167 168 Characters and Strings 168 169 * 'a', 'b', ... : Char values. **UNICODE?** … … 171 172 * `\range(e1,e2,e3)` : value of type `Range` consisting of the integers e1, e1+e3, e1+2*e3, ... that are less than or equal to e2. 172 173 * `\domain(<r1,...,rn>)` : value of type `Domain[n]`, the ordered Cartesian product of the n ranges (dictionary order) 173 * `\hasnext(dom, <i, j, …>)`: an expression of boolean type, testing if the domain `dom` contains any element after `<i, j,...>`174 * `\hasnext(dom, <i,j,…>)`: an expression of boolean type, testing if the domain `dom` contains any element after `<i,j,...>` 174 175 Arrays 175 * `\array(T, <e0, ...,en-1>)`: value of type `Array[T, n]`, a literal array176 * `\array(T, n,e)`: value of type `Array[T,n]` in which each of the n elements is `e`177 * `\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.176 * `\array(T, <e0,...,en-1>)`: value of type `Array[T, n]`, a literal array 177 * `\array(T,n,e)`: value of type `Array[T,n]` in which each of the n elements is `e` 178 * `\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. 178 179 * `\seq_add(a,e)` : array obtained by adding element e to the end of the array. Original array a is not modified. 179 180 * `\seq_append(a1,a2)` : array obtained by concatenating two arrays. Original array not modified. … … 181 182 * `\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. 182 183 Tuples 183 * `\tuple(S, <e0, e1,...>)` : value of tuple type `S` (tuple literal)184 * `\tsel(e1, i)` : tuple selection of component i of e1. i must be a literal natural number.184 * `\tuple(S,<e0,e1,...>)` : value of tuple type `S` (tuple literal) 185 * `\tsel(e1,i)` : tuple selection of component i of e1. i must be a literal natural number. 185 186 Pointers and Memory 186 187 * `NULL` : value of type `void*` 187 188 * `\deref(e)` : pointer dereference 188 189 * `\addr(e)` : address-of operator 189 * `\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.190 * `\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. 190 191 * `\psub(e1,e2)`: pointer subtraction 191 192 * `\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. 192 * `\mem_union(mem1, mem2)`, where `mem1` and `mem2` are expressions of type `Memory`. This is the union of the two memory sets.193 * `\mem_isect(mem1, mem1)` : set intersection193 * `\mem_union(mem1,mem2)`, where `mem1` and `mem2` are expressions of type `Memory`. This is the union of the two memory sets. 194 * `\mem_isect(mem1,mem1)` : set intersection 194 195 * `\mem_comp(mem1)` : set complement (everything not in `mem1`) 195 * `\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`.196 * `\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`. 196 197 Scopes and Processes 197 198 * `\root`, `\here` : values of type `Scope` … … 203 204 * `\new(t)` : new (default) value of `Dytype` t 204 205 * `\defined(e)` : is `e` defined? `Bool` type 205 * `\cast(e, T)` : casts `e` to a value of the named type206 * `\cast(e,T)` : casts `e` to a value of the named type 206 207 * need to list all of the legal casts and what they mean exactly 207 208 * cast of integer to array-of-boolean, and vice-versa? 208 209 * **Instead of casts would it be better to have explicit functions for each legal kind of cast?** 209 * `\ite(e1, e2, e3)`: if-then-else (conditional) expression, equivalent to`e1?e2:e3` in C.210 * `\ite(e1,e2,e3)`: if-then-else (conditional) expression, like `e1?e2:e3` in C. 210 211 * `e0(e1,...,en)` : a function invocation where `e` must evaluate to either an abstract or pure system function 211 212 … … 219 220 * `ASSIGN e1,e2;` 220 221 * `CALL f, <e1,...,en>;` and `CALL e, f, <e1,...,en>;` 221 * call to a function which is not abstract and is not a pure system function 222 * call to a function which is not abstract and is not a pure system function. The first form has no left-hand-side. The second form assigns the result returned by the call to `e`. 222 223 * `SPAWN f, <e1,...,en>;` and `SPAWN e, f, <e1,...,en>;` 223 224 * `WAIT e;` … … 238 239 * `ATOMIC_EXIT;` 239 240 * `PARSPAWN p, d, f;` where `p` is pointer to process reference, `d` has `Domain` type and `f` has `Function` type. 240 * `NEXT dom, <i,j,…>;` : domain iterator: updates `i`, `j`, ... to be the value of the inter tuple in `dom` after `<i, j,...>`241 * `NEXT dom, <i,j,…>;` : domain iterator: updates `i`,`j`,... to be the value of the inter tuple in `dom` after `<i,j,...>` 241 242 * `FOR_ENTER dom;` **FIX ME** 242 243 … … 338 339 A program consists of a sequence of global variable declarations, which may include declarations annotated by `$input` and `$output`, 339 340 followed by a sequence of function declarations and definitions. 341 * `\input` 342 * `\output` 340 343 341 344 == Semantics ==
