Changes between Version 95 and Version 96 of IR2
- Timestamp:
- 05/13/21 14:05:10 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IR2
v95 v96 9 9 * Expressions are side-effect free. 10 10 * 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. 11 * In general, symbols can be used before they are de fined, 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 * In general, symbols can be used before they are declared, 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. 12 12 * 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. 13 13 * Evaluation of expressions and execution of statements should always result in a value or state. There is no concept of exception or error. Hence anything that should be checked should be checked by explicit assertions. … … 17 17 18 18 1. **Do variables have default initial values?** 19 * No, a declared variable must be initialized before it is used. Otherwise, the behavior is undefined.19 * Every variable holds a value of its type, always. However the initial values of variables is unspecified. Therefore a correct CIVL-IR program should explicitly initialize every variable before it is used. Moreover, there is a defined bit associated to each variable, and it is initially false, indicating that the variable is "undefined". It becomes defined when it is assigned. Details are below. 20 20 1. **How do you initialize a variable?** 21 21 * By assigning a value to it. For example `n=$new($int);` will assign `n` an arbitrary integer, while `n=0;` will assign the integer `0` to `n`.
