Changes between Version 43 and Version 44 of IR


Ignore:
Timestamp:
11/24/15 08:54:38 (10 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IR

    v43 v44  
    55
    66* the language is not intended to be written by humans; it is an intermediate form constructed by CIVL.  However it should be readable to help debug things
    7 * the language (and grammar) are subsets of CIVL-C
     7* the language (and grammar) are subsets of CIVL-C. **MAYBE, MAYBE NOT**
    88* a CIVL-IR program represents a guarded-transition system explicitly
    99* as in CIVL-C, there are functions, scopes, and functions can be defined in any scope
    10 * all blocks (including a function body) consist of the following elements:
     10* all blocks (including a function body) consist of the following elements, in this order:
    1111 * a sequence of type definitions
    1212 * a sequence of variable declarations with no initializers
     
    1515* an array is declared without any length expression.  When it is initialized it can specify length.
    1616
    17 **Can we specify that elements must appear in the order above?**  Or would that create a problem in something like
    18 {{{
    19 {
    20   $integer x=3*y;
    21   $integer a[x+1];
    22 }
    23 }}}
    24 
    25 
    2617Example:
    27 
    2818{{{
    2919$integer f() {
     
    5242}}}
    5343
     44Example:
     45{{{
     46{
     47  $integer x=3*y;
     48  $integer a[x+1];
     49}
     50}}}
     51translates to:
     52{{{
     53{
     54  $integer x;
     55  $integer a[];
     56L1:
     57  $choose { $when ($true) x=3*y; goto L2; }
     58L2:
     59  $choose { $when ($true) a=$initval($integer[x+1]); goto L3; }
     60L3:
     61}
     62
     63
    5464==  Types ==
    5565
     
    6070* `$scope` : scope type
    6171* `$char` : character type.  Alternatively, get rid of this and just use an integer type.
    62 * `$mem` : type representing set of memory units
    6372* `$bundle` : type representing some un-typed chunk of data
    6473* `$heap` : heap type
    6574* `$range` : ordered set of integers
    6675* `$domain` : ordered set of tuples of integers
    67  * `$domain(n)`, n is an integer at least 1; subtype of above in which all tuples have arity n.
     76* `$domain(n)`, n is an integer at least 1; subtype of `$domain` in which all tuples have arity n.
    6877* `enum` types.
    6978 * **different from integers or like C?**
     
    7887 * IEEE754 floating point numbers
    7988* `$hreal` : Herbrand real numbers.  Values are unsimplified symbolic expressions.
    80 * `struct(T1,...,Tn)`
     89* `struct` types
     90 * `struct tag { decl1; ...; decln };` or
     91 * `struct tag;`
    8192 * structure type with named fields.  Names may not seem necessary but if you want a subset of CIVL-C...
    8293 * **What about bit-widths?**
    83 * `union(T1,...,Tn)` : similar to struct
     94* `union`: similar to structs
    8495* `T[]` : array-of-T
    8596* Function<S1,...,Sn;T>
    8697 * function consuming S1,...,Sn and returning T.  T can be void.  The actual notation is the horrible C notation.
    87 * `void*` : all pointers
    88  * `T*` : pointer-to-T, subtype of above
     98* `$mem` : type representing a memory set.  May be thought of as a set of pointers.
     99* `void*` : all pointers, a subtype of `$mem`
     100 * `T*` : pointer-to-T, subtype of `void*`
    89101
    90102Type facts:
     
    128140
    129141
    130 == Declarations ==
    131 
    132 Declarations follow the C notation.   Function prototypes are considered to be declarations similar to variable declarations.
    133 
    134 Example of declaration of a function:
    135 {{{
    136 $integer f($real x, $bool y);
    137 }}}
    138 
    139 Additional modifiers that may be placed on any of above:
    140 * `$pure` : the function has no side effects, but may be nondeterministic
    141 * `$abstract`: function is a pure, mathematical function: deterministic function of inputs
    142 * `$atomic_f`: function definition is atomic, and it never blocks
    143 
    144 System functions:
    145 * A function declaration which is not abstract and for which no definition is provided is a system function.
    146 * If the system function is called anywhere in the program, it must be defined by providing Java code in an Enabler and Executor.  Failure to do so will result in an exception.
    147 * A system function may modify any memory it can reach.  This includes allocating new data on heaps it can reach.
    148 * A system function may have a guard.
    149 
    150 Example of a declaration of a system function with guard.
    151 {{{
    152 $bool g($real x, $bool y) { ... }
    153 $integer f($real x, $bool y) $guard {g};
    154 }}}
    155142
    156143
     
    239226* For_dom_enter (for domains): `$for_enter(i,j,k..: dom);`
    240227
    241 
    242 == Contracts of Functions ==
     228== Declarations and Function Definitions ==
     229
     230Declarations follow the C notation.   Function prototypes are considered to be declarations similar to variable declarations.
     231
     232Example of declaration of a function:
     233{{{
     234$integer f($real x, $bool y);
     235}}}
     236
     237Additional modifiers that may be placed on any of above:
     238* `$pure` : the function has no side effects, but may be nondeterministic
     239* `$abstract`: function is a pure, mathematical function: deterministic function of inputs
     240* `$atomic_f`: function definition is atomic, and it never blocks
     241
     242System functions:
     243* A function declaration which is not abstract and for which no definition is provided is a system function.
     244* If the system function is called anywhere in the program, it must be defined by providing Java code in an Enabler and Executor.  Failure to do so will result in an exception.
     245* A system function may modify any memory it can reach.  This includes allocating new data on heaps it can reach.
     246* A system function may have a guard.
     247
     248Example of a declaration of a system function with guard.
     249{{{
     250$bool g($real x, $bool y) { ... }
     251$integer f($real x, $bool y) $guard {g};
     252}}}
     253
     254
     255== Function Contracts ==
     256
    243257* event set expressions:
    244258{{{
     
    302316}}}
    303317
    304 == Function definition ==
    305 
    306318== Program ==
    307319
     
    321333
    322334
    323 
    324335=== Transitions ===
    325336
    326337
    327 
    328338== Libraries ==