krista@2271
|
1 |
// This file is under GNU General Public License 3.0
|
krista@2271
|
2 |
// see LICENSE.txt
|
krista@2271
|
3 |
|
vb@2829
|
4 |
// FSM Y language 1.2
|
krista@2271
|
5 |
|
vb@2829
|
6 |
// Copyleft (c) 2016, 2017, p≡p foundation
|
krista@2271
|
7 |
|
krista@2271
|
8 |
// Written by Volker Birk
|
krista@2271
|
9 |
|
vb@2829
|
10 |
decl version(major, minor);
|
vb@2829
|
11 |
|
vb@2829
|
12 |
// a protocol family has a name and an ID
|
vb@2829
|
13 |
|
vb@2909
|
14 |
decl protocol @name (id, threshold=10);
|
vb@2829
|
15 |
|
vb@2829
|
16 |
// each protocol in a family has a finite state machine
|
vb@2829
|
17 |
|
vb@2909
|
18 |
decl fsm @name (id, threshold=10);
|
vb@2829
|
19 |
|
vb@2829
|
20 |
// a state has a name and a timeout; after the timeout the state machine will
|
vb@2829
|
21 |
// be reset
|
vb@2829
|
22 |
|
vb@2908
|
23 |
decl state @name (timeout=on);
|
vb@2829
|
24 |
|
vb@2829
|
25 |
// events have names
|
vb@2829
|
26 |
|
krista@2271
|
27 |
decl event @name, on is event;
|
vb@2829
|
28 |
|
vb@2830
|
29 |
// external events can have IDs
|
vb@2830
|
30 |
|
vb@2830
|
31 |
decl external @name (id);
|
vb@2830
|
32 |
|
vb@2829
|
33 |
// a transistion moves the statemachine to another state
|
vb@2829
|
34 |
|
krista@2271
|
35 |
decl transition @target, go is transition;
|
vb@2829
|
36 |
|
vb@2829
|
37 |
// an action is executed; if an action name starts with 'send' then it is
|
vb@2829
|
38 |
// sending a message
|
vb@2829
|
39 |
|
krista@2271
|
40 |
decl action @name, do is action;
|
vb@2829
|
41 |
|
vb@2865
|
42 |
// send network messages
|
vb@2865
|
43 |
|
vb@2877
|
44 |
decl send @name;
|
vb@2865
|
45 |
|
vb@2829
|
46 |
// a condition is for different cases
|
vb@2829
|
47 |
|
krista@2271
|
48 |
decl condition @name, if is condition;
|
vb@2907
|
49 |
decl else;
|
vb@2829
|
50 |
|
vb@2829
|
51 |
// some events have messages on the line signalling the event to the
|
vb@2829
|
52 |
// communication partner
|
vb@2829
|
53 |
|
vb@2908
|
54 |
decl message @name (id, type=anycast, security=trusted);
|
vb@2829
|
55 |
|
vb@2829
|
56 |
// messages can have transmitted fields…
|
vb@2829
|
57 |
|
vb@2829
|
58 |
decl field @type @name;
|
vb@2829
|
59 |
|
vb@2829
|
60 |
// … or automatically calculated fields…
|
vb@2829
|
61 |
|
vb@2829
|
62 |
decl auto < field >;
|
vb@2829
|
63 |
|
vb@4260
|
64 |
// … or list of fields
|
vb@4260
|
65 |
|
vb@4260
|
66 |
decl list < field >;
|
vb@4260
|
67 |
|