Changes between Version 65 and Version 66 of IR


Ignore:
Timestamp:
11/25/15 21:38:55 (10 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IR

    v65 v66  
    130130
    131131L0:
    132   when (\true) assign n, 10; goto L1;
     132  when (\true) ASSIGN n, 10; goto L1;
    133133L1:
    134   when (\true) assign S_d, \dytype(Tuple[<Array[Integer, n]]>); goto L2;
     134  when (\true) ASSIGN S_d, \dytype(Tuple[<Array[Integer, n]]>); goto L2;
    135135L2:
    136   when (\true) assign x1, \new(S_d); goto L3;
     136  when (\true) ASSIGN x1, \new(S_d); goto L3;
    137137L3:
    138   when (\true) assign n, 20; goto L4;
     138  when (\true) ASSIGN n, 20; goto L4;
    139139L4:
    140   when (\true) assign x2, \new(S_d); goto L5;
     140  when (\true) ASSIGN x2, \new(S_d); goto L5;
    141141L5:
    142142}}}
     
    150150* `\true`, `\false` : literal values of type `Bool`
    151151* `\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.
    156157Numeric
    157158* 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. 
    159160 * `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)` : subtraction
    161 * `\mul(e1, e2)` : multiplication
    162 * `\div(e1, e2)` : division
     161* `\sub(e1,e2)` : subtraction
     162* `\mul(e1,e2)` : multiplication
     163* `\div(e1,e2)` : division
    163164 * 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 modulus
     165* `\mod(e1,e2)` : integer modulus
    165166* `\neg(e)` : negative
    166 * `\lt(e1, e2)`, `\lte(e1, e2)`: less than/less than or equal to
     167* `\lt(e1,e2)`, `\lte(e1,e2)`: less than/less than or equal to
    167168Characters and Strings
    168169* 'a', 'b', ... : Char values.  **UNICODE?**
     
    171172* `\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.
    172173* `\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,...>`
    174175Arrays
    175 * `\array(T, <e0, ..., en-1>)`: value of type `Array[T, n]`, a literal array
    176 * `\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.
    178179* `\seq_add(a,e)` : array obtained by adding element e to the end of the array.  Original array a is not modified.
    179180* `\seq_append(a1,a2)` : array obtained by concatenating two arrays.  Original array not modified.
     
    181182* `\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.
    182183Tuples
    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.
    185186Pointers and Memory
    186187* `NULL` : value of type `void*`
    187188* `\deref(e)` : pointer dereference
    188189* `\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.
    190191* `\psub(e1,e2)`: pointer subtraction
    191192* `\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 intersection
     193* `\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
    194195* `\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`.
    196197Scopes and Processes
    197198* `\root`, `\here` : values of type `Scope`
     
    203204* `\new(t)` : new (default) value of `Dytype` t
    204205* `\defined(e)` : is `e` defined? `Bool` type
    205 * `\cast(e, T)` : casts `e` to a value of the named type
     206* `\cast(e,T)` : casts `e` to a value of the named type
    206207 * need to list all of the legal casts and what they mean exactly
    207208 * cast of integer to array-of-boolean, and vice-versa?
    208209 * **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.
    210211* `e0(e1,...,en)` : a function invocation where `e` must evaluate to either an abstract or pure system function
    211212
     
    219220* `ASSIGN e1,e2;`
    220221* `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`.
    222223* `SPAWN f, <e1,...,en>;` and `SPAWN e, f, <e1,...,en>;`
    223224* `WAIT e;`
     
    238239* `ATOMIC_EXIT;`
    239240* `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,...>`
    241242* `FOR_ENTER dom;` **FIX ME**
    242243
     
    338339A program consists of a sequence of global variable declarations, which may include declarations annotated by `$input` and `$output`,
    339340followed by a sequence of function declarations and definitions.
     341* `\input`
     342* `\output`
    340343
    341344== Semantics ==