source: CIVL/notes/civlc.txt@ af8a6cb

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since af8a6cb was d96fdd6d, checked in by Stephen Siegel <siegel@…>, 14 years ago

Setting up CIVL-C grammar.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@3 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.4 KB
Line 
1The CIVL-C code will not have an explicit "Root" procedure.
2Instead, a Root procedure will be implicitly wrapped around
3the enitre code. The global input variables will become
4the inputs to the Root procedure.
5
6Syntactic changes from C:
7
8_input int n; // type modifier: global variable is input
9_output double y; // ditto
10
11function definitions in any scope
12
13_spawn f(...); /* this is an expression with side-effects */
14
15_wait expr; /* this is a statement */
16
17_assert expr; /* statement */
18
19_assume expr; /* statement */
20
21_when (expr) stmt; /* guarded command */
22
23/* nondeterministic choice: */
24_choose {
25 stmt1;
26 stmt2;
27 ...
28 default: stmt
29}
30
31the "default" clause is optional.
32
33example: this shows how to encode "low-level" CIVL:
34
35l1: _choose {
36 _when (x>0) {x--; goto l2;}
37 _when (x==0) {y=1; goto l3;}
38 default: {z=1; goto l4;}
39}
40
41loop invariants: each loop construct has an optional invariant
42clause as follows:
43
44while (expr) _invariant (expr) stmt
45
46for (e1; e2; e3) _invariant (expr) stmt
47
48do stmt while (expr) _invariant (expr) ;
49
50optional elements preceding procedure decls:
51
52requires expr ;
53ensures expr ;
54
55expressions:
56 expr@x : refer to variable in other process, e.g., procs[i]@x
57 \collective(array-expression) e : collective assertion over
58 set of processes in array
59
60example:
61
62_proc procs[N];
63...
64assert \collective(procs) i==procs[pid+1]@i ;
65
66Elements not added to grammar:
67
68_proc : process type
69_self : constant of type _proc indicating "me"
Note: See TracBrowser for help on using the repository browser.