sync/fsm.yml2
author Volker Birk <vb@pep.foundation>
Tue, 21 Aug 2018 20:28:07 +0200
branchsync
changeset 2865 96aaa55b2a54
parent 2830 d6f044e43e1a
child 2868 d812e7a24b52
permissions -rw-r--r--
reworking send message
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@2829
    14
decl protocol @name (id);
vb@2829
    15
vb@2829
    16
// each protocol in a family has a finite state machine
vb@2829
    17
vb@2829
    18
decl fsm< protocol >;
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
krista@2271
    23
decl state @name (timeout=0);
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@2865
    44
decl send @name (type="unicast");
vb@2865
    45
decl broadcast @name (type="broadcast") alias send;
vb@2865
    46
vb@2829
    47
// a condition is for different cases
vb@2829
    48
krista@2271
    49
decl condition @name, if is condition;
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@2829
    54
decl message @name (id);
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