Changes between Version 127 and Version 128 of IR2
- Timestamp:
- 06/10/21 13:41:55 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IR2
v127 v128 123 123 type-specifier: 124 124 ID type-args? /* type parameter or (possibly parameterized) typedef use */ 125 | '$int' size-spec /* mathematical integers */126 | '$bool' size-spec /* boolean type ($true and $false, unrelated to integers) */127 | '$char' size-spec /* character type (Unicode characters, unrelated to integers) */128 | '$real' size-spec /* mathematical reals */129 | '$float' size-spec /* IEEE floating-point numbers */125 | '$int' size-spec? /* mathematical integers */ 126 | '$bool' size-spec? /* boolean type ($true and $false, unrelated to integers) */ 127 | '$char' size-spec? /* character type (Unicode characters, unrelated to integers) */ 128 | '$real' size-spec? /* mathematical reals */ 129 | '$float' size-spec? /* IEEE floating-point numbers */ 130 130 | '$herbrand' '<' type-name '>' /* Herbrand type of non-Herbrand numeric type T */ 131 131 | '$proc' /* process type */ … … 164 164 === Notes === 165 165 166 * Certain basic types can have a specified size---the number of bytes consumed by an object of that type. These basic types include '$bool', '$int', '$char', and '$real'. Two versions of the basic type with different sizes are in fact disjoint types. The basic type without a specified size has domain the union over all sizes of the size-qualified type. TODO: require this or option?166 * Certain basic types can have a specified size---the number of bytes consumed by an object of that type. These basic types include '$bool', '$int', '$char', and '$real'. Two versions of the basic type with different sizes are in fact disjoint types. There is also a basic type without a specified size, and this type is distinct from all the sized types. Certain operations require a sized type (specify these!). 167 167 * Sequences, sets, maps, relations, and `$mem` objects are immutable. An assignment using objects of this type creates a new copy of the object, just as with primitive types like `$int`. 168 168 * Arrays are similar to sequences. The main differences are as follows: 169 * An object (i.e., a variable or component of an object) of array type is initialized once, then will never be assigned to again. Hence there cannot be a statement of the form `a=...` where `a` has array type. 169 * An object (i.e., a variable or component of an object) of array type is initialized once, then will never be assigned to again. Hence there cannot be a statement of the form `a=...` where `a` has array type. (Except for the first one?) 170 170 * After initialization, an object of array type can appear only as the first (left) argument to the subscript operator `[]` or as the argument to the `$length` operator. 171 171 * Arrays are mutable. As in C, the left hand size of an assignment may have the form `a[i]`, where `a` is an object of array type. Sequences are immutable. … … 343 343 === `civlc.cvh` === 344 344 345 Work in progress. Refer to existing library. 346 347 {{{ 348 <T1,T2> struct $pair { T1 left; T2 right; }; 349 <T1,T2> typedef struct $pair<T1,T2> $pair; 350 <T> $system T * $alloc($heap * h, T obj); // add an object to a heap 351 $system $free($void * p); // remove an object from the heap 352 $system void $exit(); // terminate process immediately 353 $system $bool $terminated($proc p); // has the process terminated? 354 $template <$int s> $system $int<s> $choose_int($int<s> n); // nondeterministic choice of int in 0..n-1 345 Work in progress. Refer to existing library. All include`$system<"civl.library", "civlc">`. 346 347 {{{ 348 $template <$typenameT1, $typename T2> struct $pair { T1 left; T2 right; }; 349 $template <$typenameT1, $typename T2> typedef struct $pair<T1,T2> $pair; 350 $template <$typename T> $pure_f $int $sizeof($type<T> type); 351 $template <$typename T> T * $alloc($heap * h, T obj); // add an object to a heap 352 $int $choose_int($int n); // nondeterministic choice of int in 0..n-1 353 $free($void * p); // remove an object from the heap 354 void $exit(); // terminate process immediately 355 $bool $terminated($proc p); // has the process terminated? 355 356 356 357 }}}
