Changes between Version 100 and Version 101 of IR2


Ignore:
Timestamp:
05/14/21 10:48:25 (5 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IR2

    v100 v101  
    1717
    18181. **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.
    20201. **How do you initialize a variable?**
    2121  * 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`.
     
    5252  ;
    5353decl: function-decl | object-decl ;
    54 function-decl: type-param-list? function-qualifier*  type-specifier declarator contract-clause* ';' ;
     54function-decl: type-param-list? function-kind function-qualifier*  type-specifier declarator contract-clause* ';' ;
     55function-kind:
     56    '$abstract_f'  /* abstract function; only for function decls */
     57  | '$system_f' '<' STRING ',' STRING '>'  /* function is defined in system code elsewhere */
     58  ;
     59function-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  ;
    5564object-decl: type-specifier declarator '=' initializer ';' ;
    5665function-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   ;
    6466block: '{' typedef* decl* function-definition* statement* '}' ;
    6567statement: block | simpleStmt | chooseStmt ;