Changes between Version 95 and Version 96 of IR


Ignore:
Timestamp:
11/30/15 09:15:28 (10 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IR

    v95 v96  
    77* a CIVL-IR program represents a guarded-transition system explicitly
    88* as in CIVL-C, there are functions, scopes, and functions can be defined in any scope
    9 * all blocks (including a function body) consist of the following elements, in this order:
     9* all blocks (including a function definition) consist of the following elements, in this order:
     10 * a sequence of contract clauses (for function definitions only)
    1011 * a sequence of type definitions
    11  * a sequence of variable declarations with no initializers
     12 * a sequence of variable declarations (with no initializers)
    1213 * a sequence of function definitions
    13  * a sequence of labeled statements.   Each clause in the labeled statement is a `when` statement with some guard and a primitive statement, followed by a `goto` statement
     14 * a body, which encodes a program graph.
    1415* an array is declared without any length expression.  When it is initialized it can specify length.
    1516* curly braces are used only to indicate scopes, as in `{ // new scope ... }`
     
    1920* unlike C, there is no "array-pointer pun".   If an array `a` needs to be converted to a pointer, you must use addr(asub(a, 0))`.
    2021* 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.
     22* 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.
    2123
    2224== Grammar ==
     
    2628{{{
    2729program: block ;
    28 block: typedef* vardecl* fundef* statement+ ;
    29 statement: blockStmt | basicStmt ;
     30blockitems: typedef* vardecl* fundef* statement* ;
     31statement: '{' blockitems '}' | basicStmt ;
    3032basicStmt:  (ID ':')? (simpleStmt | chooseStmt) ;
    3133simpleStmt: (guardedStmt | primitiveStmt) ('goto' ID)? ;
    3234guardedStmt: 'when' expr 'do' primitiveStmt ;
    3335chooseStmt: 'begin choose' simpleStmt+ 'end choose' ;
    34 blockStmt: '{' block '}' ;
    3536typedef: 'type' ID '=' typeName ';' ;
    3637vardecl: 'var' varopts? ID ':' typeName ';' ;
    3738varopts: '[' varopt+ ']' ;
    3839varopt: 'input' | 'output' ;
    39 fundef:  'fun' funopts? ...
     40fundef:  'fun' funopts? ID '(' paramlist ')' ':' typeName '{' conclause* blockitems '}' ;
     41funopts: '[' funopt+ ']' ;
     42conclause : 'assigns' expr ';'
     43                 | 'requires' expr ';'
     44                 | 'ensures' expr ';'
     45                 ...
     46                 ;
    4047}}}
    4148