Changes between Version 50 and Version 51 of IR2
- Timestamp:
- 04/29/21 10:03:22 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IR2
v50 v51 9 9 * There are no automatic conversions. All conversions must be by explicit casts or other functions. Operations such as numeric addition (add) require that both operands have the exact same type. 10 10 * In general, symbols can be used before they are defined, as long as they are in scope. For example, a function f can call g, even if g is defined after f in the same scope. There is no need for a "prototype". Similarly, a type definition can refer to a type defined later, or can refer to itself in its own definition. 11 * Many of the core operations are implemented as functions in the standard library. This is similar to C. The header files for the standard library are an integral part of the language. 11 12 12 13 … … 20 21 * An array variable `a` is declared with a decl such as `T a[];`, and then a statement such as `a=$new(T[n]);` will assign to `a` a new arbitrary array value for an array of length `n` of elements of type `T`. For heap-allocation, a pointer is declared with a decl such as `T * p;`, and a heap variable is also declared somewhere with a decl such as `$heap heap;` and then a statement such as `p = $alloc(&heap, n, T);` will add a new object to the heap and return a pointer to the first element. An `$alloc`-ed object can be deallocated with `$free(p);`. 21 22 1. **Is there an "array-pointer pun", as in C?** 22 * No, if you want a pointer to element 0 of an array, you have to explicitly saysomething like `&a[0]`.23 * No, if you want a pointer to element 0 of an array, you have to explicitly write something like `&a[0]`. 23 24 1. **How to you translate between sequences and arrays?** 24 1. Can you make types values? (reification) 25 1. read/write sets: function calls to start, stop monitoring reads/writes? All part of mem library 26 1. a type for $state ? 27 1. How do you model `malloc` when the element type is not known? (Create a type `$byte`?) 28 1. How do you iterate over a domain? 25 * There are functions in the standard library to do that. 26 1. ** Can you make types values? (reification)** 27 * For now, no. There are several statements and expressions which do take a type name as an argument, but there is no way for one to define new expressions or functions that do that. 28 1. ** How do you monitor reads and writes?** 29 * There are functions in the standard library (`mem.h`) for this. 30 1. **Is there a type for $state ? ** 31 * Coming soon. 32 1. **How do you model `malloc` when the element type is not known?** 33 * For now, you can't. [Note to self: consider creating a type like `$byte` for this purpose?] 34 1. **How do you iterate over a domain?** 35 * Coming soon. 29 36 30 37 == Grammar ==
