Changes between Version 100 and Version 101 of IR2
- Timestamp:
- 05/14/21 10:48:25 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IR2
v100 v101 17 17 18 18 1. **Do variables have default initial values?** 19 * No. Every variable (other than a variable designating a system or abstract function)must must be explicitly initialized. However, `$undef` can be used as the initializer, indicating that the variable is undefined. Even in this case, the variable has some unspecified value of its type. Details are below.19 * No. Every object variable must must be explicitly initialized. However, `$undef` can be used as the initializer, indicating that the variable is undefined. Even in this case, the variable has some unspecified value of its type. Details are below. 20 20 1. **How do you initialize a variable?** 21 21 * In the declaration. For example `$int n=$new($int);` will assign `n` an arbitrary integer, while `$int n=0;` will assign the integer `0` to `n`. … … 52 52 ; 53 53 decl: function-decl | object-decl ; 54 function-decl: type-param-list? function-qualifier* type-specifier declarator contract-clause* ';' ; 54 function-decl: type-param-list? function-kind function-qualifier* type-specifier declarator contract-clause* ';' ; 55 function-kind: 56 '$abstract_f' /* abstract function; only for function decls */ 57 | '$system_f' '<' STRING ',' STRING '>' /* function is defined in system code elsewhere */ 58 ; 59 function-qualifier: 60 '$pure_f' /* function is a mathematical function of its parameters */ 61 | '$state_f' /* function is a mathematical function of the state */ 62 | '$atomic_f' /* function invocations take place atomically */ 63 ; 55 64 object-decl: type-specifier declarator '=' initializer ';' ; 56 65 function-definition: type-param-list? function-qualifier* type-specifier declarator contract-clause* block ; 57 function-qualifier:58 '$abstract_f' /* abstract function; only for function decls */59 | '$pure_f' /* function is a mathematical function of its parameters */60 | '$state_f' /* function is a mathematical function of the state */61 | '$atomic_f' /* function invocations take place atomically */62 | '$system_f' '<' STRING ',' STRING '>' /* function is defined in system code elsewhere */63 ;64 66 block: '{' typedef* decl* function-definition* statement* '}' ; 65 67 statement: block | simpleStmt | chooseStmt ;
