| 89 | | | '$parspawn' expr ',' expr ',' expr ';' |
| 90 | | | (lvalue '=')? '$malloc' '(' expr ',' expr ',' type-name ')' ';' |
| 91 | | |
| | 89 | | '$parspawn' expr ',' expr ',' expr ';' /* parallel spawn */ |
| | 90 | | (lvalue '=')? '$alloc' expr ',' expr ',' type-name ';' /* heap allocation */ |
| | 91 | arg-list: expr (',' expr)* ; /* actual argument list */ |
| | 92 | |
| | 94 | |
| | 95 | Notes |
| | 96 | * 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. |
| | 97 | * 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. |
| | 98 | * 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`. |