| Version 16 (modified by , 10 years ago) ( diff ) |
|---|
The CIVL-IR. Also known as "CIVL model".
Grammar:
- a subset of CIVL-C, explicit guarded-transition systems
- functions, scopes, functions defined in any scope
- all blocks start with variable declarations; no initializers
- an array is declared without any length expression. When it is initialized it can specify length.
Example:
$integer f() {
$real x;
$real y;
$float(16,23) z;
L1 :
$choose {
$when (g1) stmt1; goto L2;
$when (g2) stmt2; goto L3;
}
{ // begin new scope
$real x;
L2 :
$choose {
$when (g3) stmt3; goto L4;
...
}
} // end new scope
...
}
// etc.
Static Types
$bool: boolean type, values are$trueand$false$proc$scope$char$mem$bundle$heap$range$domain$domain(n), n is an integer at least 1; subtype of above
enumtypes.- different from integers or like C?
$integer: the mathematical integers$int(lo,hi,wrap)- lo, hi are integers, wrap is boolean
- finite interval of integers [lo,hi]. If
wrapis true then all operations "wrap", otherwise, any operation resulting in a value outside of the interval results in an exception being thrown.
$real: the mathematical real numbers$float(e,f), e, f are integers, each at least 1- IEEE754 floating point numbers
struct(T1,...,Tn)- Why do we need the field names?
- What about bit-widths?
union(T1,...,Tn): similar to structT[]: array-of-TFunction<S1,...,Sn;T>void*: all pointersT*: pointer-to-T, subtype of above
When are two types equal?
What are two types compatible?
Expressions
- literals
$true,$false: values of type$bool- 123, -123, 3.1415, etc. : values of type
$integer,$int,$real,$float- what particular notations for floating values?
- 'a', 'b', ... UNICODE?
(T[]){e0, e1, ...}: values of typeT[](S){e0, ...}: values of typeS(struct literal)e1..e2,e1..e2#e3: values of type$range($domain){r1,...,rn}: value of type$domain(n)"abc": string literals: value of type$char[]$root,$here: values of type$scope$self,$proc_null: values of type$procNULL: value of typevoid*
- variables
$defined(e1)e1+e2: additione1-e2: subtractione1*e2: multiplicatione1/e2: divisione1%e2: moduluse1[e2]: array index*e: pointer dereference&e: address-of!e: logical not-e: negative(T)e: cast expression- cast of integer to array-of-boolean, and vice-versa?
e1==e2,e1!=e2e1&&e2,e1||e2e1?e2:e3e1<e2,e1<=e2e0(e1,...,en): pure function call?$forall,$existse1.i, some natural number i (tuple read)$initial_value(T; e1,...,en)- e1,...,en are expressions of integer type
- the type of this expression is T[e1]...[en]
- array value with base type
Tand length e1,...,en
$typeof(...): what is this for?$sizeof(T): T is a type name?e1&e2,e1|e2,e1^e2,~e1: bit-wise operations: arguments are arrays of booleans
Statements
- Assign
- Call
- regular function (one with flow graph)
- system function?
- abstract function?
- pure functions?
- Spawn
- Wait
- Wailtall?
- Malloc
- Free
- Noop
- Return
- Atomic_enter
- Atomic_exit
- Parfor_spawn. is there exit?
- For_dom_enter (for domains). exit?
Program Graph
Model
Semantics
Semantics issues
- define every possible cast
- define every possible +, etc.
- define every kind of pointer value and casts between pointer types
- casts between pointer and integer types?
Values
Transitions
Libraries
Note:
See TracWiki
for help on using the wiki.
