Changes between Version 39 and Version 40 of IR2
- Timestamp:
- 04/28/21 17:04:16 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IR2
v39 v40 1 = = CIVL IR ==1 = CIVL IR = 2 2 3 == = Language principles ===3 == Language principles == 4 4 5 5 * CIVL-IR is a subset of CIVL-C. A CIVL-IR program is a CIVL-C program, and has the same semantics. … … 28 28 29 29 30 == = Grammar ===30 == Grammar == 31 31 32 32 {{{ … … 66 66 }}} 67 67 68 Notes 68 === Notes === 69 69 70 * A declaration declares a variable to have either an object type or a function type. (An object type is any type that is not a function type.) 70 71 * A variable of function type represents either an abstract or a system function. The declaration of such a variable must use either the qualifier `$abstract` or `$system`. Moreover, those two qualifiers can only be used in a declaration of function type. … … 87 88 }}} 88 89 89 === Types === 90 == Types == 91 90 92 {{{ 91 93 type-specifier: … … 124 126 }}} 125 127 126 Notes 128 === Notes === 127 129 * Sequences, sets, maps, and relations are immutable. An assignment using objects of this type creates a new copy of the object, just as with primitive types like `int`. 128 130 * The main difference between the array type and the sequence type is that elements of an array are addressable, i.e., one can form a pointer such as `&a[i]`. This is not possible with sequences, sets, maps, or relations---there is no way to have a pointer to any component of such a type. … … 131 133 132 134 133 == = Statements ===135 == Statements == 134 136 135 137 {{{ … … 146 148 }}} 147 149 148 Notes 150 === Notes === 151 149 152 * For function calls and spawns, the first expression shall have type pointer-to-function-.... The function pointed to will be the one called or spawned. That function must be a system or defined function (not an abstract function). 150 153 * The 3 expressions in a `$parspawn` are (1) pointer to the first element of the process array, an expression of type `$proc*`, (2) an expression of type `$domain`, and (3) an expression of type pointer-to-function-.... The function must have the type that consumes n `$int`s, where n is the dimension of the domain, and returns `void`. The function is spawned once for each element of the domain. References to the new processes are stored in the process array. 151 154 * The first expression following `$alloc` has type `$heap*`. It is a pointer to the heap that will be modified by allocating the new memory. The second expression has type `$int` and is the number of elements being allocated. This is followed by the element type. The function returns a pointer to the first element of an array, similar to C's malloc. It is deallocated using function`$free`. 152 155 153 Built-in functions: 156 157 == Expressions == 158 159 {{{ 160 expr: 161 $new(type-name) /* returns a new arbitrary value of the given type */ 162 | 163 164 }}} 165 166 167 == Standard CIVL Library == 168 169 === `civlc.cvh` === 170 154 171 {{{ 155 172 void $assert( $bool asserted_expr, ... ); /* assertion with optional error message */ … … 161 178 }}} 162 179 163 === Expressions===180 === `mem.cvh` === 164 181 165 {{{ 166 expr: 167 $new(type-name) /* returns a new arbitrary value of the given type */ 168 | 182 === `seq.cvh` === 169 183 170 }}} 184 === `map.cvh` === 185 186 === `concurrency.cvh` === 171 187 172 188 173
