source: CIVL/notes/civlc.txt@ 9ae277d

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

Debugged parser, added examples, for CIVLC.

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