Castle: The best Real-Time/Embedded/HighTech language EVER. Attempt 2
修订版 | 5fe4f028e4acddef550d8a026f27c595bee58112 (tree) |
---|---|
时间 | 2023-10-09 18:15:38 |
作者 | Albert Mietus < albert AT mietus DOT nl > |
Commiter | Albert Mietus < albert AT mietus DOT nl > |
Some rst/uml diagrams added on TestDoubles/AIGR :protocols
@@ -0,0 +1,139 @@ | ||
1 | +OLD-Peg Diagram | |
2 | +=============== | |
3 | + | |
4 | +This anayse/design(?) date from around 2021/2022 | |
5 | + | |
6 | +.. UML:: | |
7 | + | |
8 | + @startuml | |
9 | + | |
10 | + package _base { | |
11 | + | |
12 | + abstract AST_BASE { | |
13 | + -_parse_tree | |
14 | + +position() | |
15 | + +position_end() | |
16 | + ~serialize() | |
17 | + } | |
18 | + | |
19 | + class ID { | |
20 | + +name | |
21 | + #validate_or_raise() | |
22 | + } | |
23 | + | |
24 | + ID =|> AST_BASE | |
25 | + } | |
26 | + | |
27 | + package MixIns #Gray { | |
28 | + | |
29 | + class MixIn_value_attribute<MixIn> { | |
30 | + _value | |
31 | + value() | |
32 | + } | |
33 | + | |
34 | + class MixIn_expr_attribute<MixIn> { | |
35 | + _expr | |
36 | + expr() | |
37 | + } | |
38 | + | |
39 | + class MixIn_children_tuple<MixIn> { | |
40 | + _children :Tuple | |
41 | + __len__() | |
42 | + __getitem__() | |
43 | + __iter__() | |
44 | + } | |
45 | + } | |
46 | + | |
47 | + package Peg #0077ff { | |
48 | + | |
49 | + abstract PEG | |
50 | + AST_BASE <|== PEG | |
51 | + | |
52 | + | |
53 | + | |
54 | + abstract Terminal | |
55 | + PEG <|== Terminal | |
56 | + MixIn_value_attribute <|... Terminal | |
57 | + Terminal <|== StrTerm | |
58 | + Terminal <|== RexExpTerm | |
59 | + Terminal <|== Number | |
60 | + | |
61 | + abstract Markers #Orange | |
62 | + annotation EOF #Orange | |
63 | + PEG <|== Markers | |
64 | + Markers <|== EOF | |
65 | + | |
66 | + abstract NonTerminal | |
67 | + PEG <|== NonTerminal | |
68 | + abstract Expression | |
69 | + NonTerminal <|== Expression | |
70 | + | |
71 | + class Setting { | |
72 | + name : ID | |
73 | + value | |
74 | + } | |
75 | + PEG <|== Setting | |
76 | + | |
77 | + class Rule { | |
78 | + name :ID | |
79 | + expr :[] Expression | |
80 | + } | |
81 | + NonTerminal <|== Rule | |
82 | + | |
83 | + interface Rules | |
84 | + PEG <|== Rules | |
85 | + MixIn_children_tuple <|... Rules | |
86 | + Rules <|== ParseRules | |
87 | + Rules <|== Settings | |
88 | + | |
89 | + class Grammar { | |
90 | + +all_rules :Rules | |
91 | + -parse_rules :ParseRules | |
92 | + -settings :Settings | |
93 | + } | |
94 | + NonTerminal <|== Grammar | |
95 | + | |
96 | + | |
97 | + abstract Group | |
98 | + Expression <|== Group | |
99 | + Group <|== UnorderedGroup | |
100 | + MixIn_expr_attribute <|... UnorderedGroup | |
101 | + abstract Quantity | |
102 | + Group <|== Quantity | |
103 | + MixIn_expr_attribute <|... Quantity | |
104 | + Expression <|== Sequence | |
105 | + MixIn_children_tuple <|... Sequence | |
106 | + | |
107 | + Expression <|== OrderedChoice | |
108 | + MixIn_children_tuple <|... OrderedChoice | |
109 | + | |
110 | + class Optional << (?, #0077ff) >> | |
111 | + Quantity <|== Optional | |
112 | + class ZeroOrMore << (*, #0077ff) >> | |
113 | + Quantity <|== ZeroOrMore | |
114 | + class OneOrMore << (+, #0077ff) >> | |
115 | + Quantity <|== OneOrMore | |
116 | + | |
117 | + abstract Predicate | |
118 | + Expression <|== Predicate | |
119 | + MixIn_expr_attribute <|... Predicate | |
120 | + class AndPredicate << (&, #0077ff) notconsuming >> | |
121 | + Predicate <|== AndPredicate | |
122 | + class NotPredicate << (! ,#0077ff) not consuming >> | |
123 | + Predicate <|== NotPredicate | |
124 | + | |
125 | + } | |
126 | + @enduml | |
127 | + | |
128 | + | |
129 | + | |
130 | + | |
131 | + | |
132 | + | |
133 | + | |
134 | + | |
135 | + | |
136 | + | |
137 | + | |
138 | + | |
139 | + |
@@ -1,4 +1,8 @@ | ||
1 | -AIGR:: ComponentInterface and Protocols (231005) | |
1 | +.. -*- plantuml -*- | |
2 | +.. filename: date of start | |
3 | +.. date in title: last version | |
4 | + | |
5 | +AIGR:: ComponentInterface and Protocols (231009) | |
2 | 6 | ================================================ |
3 | 7 | |
4 | 8 | .. uml:: |
@@ -6,65 +10,41 @@ | ||
6 | 10 | @startuml |
7 | 11 | |
8 | 12 | abstract AIGR |
9 | - class CompomnentInterface | |
13 | + class ComponentInterface | |
10 | 14 | class Protocol |
11 | 15 | class EventProtocol |
12 | 16 | class Port { |
13 | 17 | - direction :PortDirection |
14 | 18 | - type :PortType |
15 | 19 | } |
16 | - | |
17 | - | |
18 | 20 | abstract ProtocolWrapper { |
19 | 21 | -based_on\n(the Generic Protocol) |
20 | 22 | } |
21 | - | |
22 | 23 | class Argument <<(S,lightgreen)>> { |
23 | 24 | +value :Any |
24 | 25 | +name :Optional[Str] |
25 | 26 | } |
26 | - | |
27 | 27 | class TypedParameters <<(S,lightgreen)>> { |
28 | 28 | +name :str |
29 | 29 | +type :Type |
30 | 30 | } |
31 | - | |
32 | 31 | class Type <<(T,lightblue)>> |
32 | + '-------------------- | |
33 | 33 | |
34 | - AIGR <-- Protocol | |
35 | - AIGR <-- Event | |
36 | - AIGR <-- CompomnentInterface | |
37 | - | |
38 | - CompomnentInterface <--- CompomnentInterface: based_on | |
39 | - CompomnentInterface *-- "*" Port | |
40 | - | |
34 | + ComponentInterface <--- ComponentInterface: based_on | |
35 | + Port "*" -* ComponentInterface | |
41 | 36 | |
42 | 37 | Protocol <--- Protocol: based_on |
43 | 38 | Protocol <-- EventProtocol |
44 | 39 | Protocol <-- ProtocolWrapper |
45 | 40 | |
46 | - | |
47 | 41 | ProtocolWrapper *- "+"Argument |
48 | 42 | |
49 | - EventProtocol *-- "*" Event: events | |
43 | + EventProtocol *- "*" Event: events | |
50 | 44 | Event *-- "*" TypedParameters : typedParameters |
51 | 45 | Event o- "?" Type: returns |
52 | 46 | |
53 | - Port o--- Protocol: type | |
54 | - | |
55 | - | |
56 | - package ToDesign <<Rectangle>> #gray { | |
57 | - class Compomnent | |
58 | - class CompomnentImplementation | |
59 | - Compomnent *- CompomnentInterface | |
60 | - Compomnent *- CompomnentImplementation | |
47 | + Port o. Protocol: type | |
61 | 48 | |
62 | - } | |
49 | + @enduml | |
63 | 50 | |
64 | - package ToDo/Later <<Rectangle>> #gray { | |
65 | - Protocol <- DataProtocol | |
66 | - Protocol <-- StreamProtocol | |
67 | - | |
68 | - } | |
69 | - @enduml | |
70 | - |
@@ -0,0 +1,42 @@ | ||
1 | +.. -*- plantuml -*- | |
2 | + | |
3 | +TestDoubles/AIGR: The protocols of the Sieve | |
4 | +============================================ | |
5 | + | |
6 | +.. uml:: | |
7 | + | |
8 | + @startuml | |
9 | + | |
10 | + object StartSieve <<EventProtocol>> | |
11 | + object runTo <<Event>>{ | |
12 | + max: int | |
13 | + } | |
14 | + object newMax <<Event>> { | |
15 | + max: int | |
16 | + } | |
17 | + StartSieve *-- runTo | |
18 | + StartSieve *-- newMax | |
19 | + | |
20 | + '--- | |
21 | + | |
22 | + object SlowStart << EventProtocol>> | |
23 | + object queue_max <<TypedParameter>> { | |
24 | + :int | |
25 | + } | |
26 | + object setMax <<Event>> { | |
27 | + setMax :int | |
28 | + } | |
29 | + SlowStart *-- setMax | |
30 | + SlowStart *- queue_max | |
31 | + | |
32 | + '--- | |
33 | + | |
34 | + object SimpleSieve <<EventProtocol>> | |
35 | + SlowStart <-- SimpleSieve: based_on | |
36 | + | |
37 | + object input <<Event>> { | |
38 | + try :int | |
39 | + } | |
40 | + SimpleSieve *--input | |
41 | + | |
42 | + @enduml |
@@ -1,139 +0,0 @@ | ||
1 | -OLD-Peg Diagram | |
2 | -=============== | |
3 | - | |
4 | -This anayse/design(?) date from around 2021/2022 | |
5 | - | |
6 | -.. UML:: | |
7 | - | |
8 | - @startuml | |
9 | - | |
10 | - package _base { | |
11 | - | |
12 | - abstract AST_BASE { | |
13 | - -_parse_tree | |
14 | - +position() | |
15 | - +position_end() | |
16 | - ~serialize() | |
17 | - } | |
18 | - | |
19 | - class ID { | |
20 | - +name | |
21 | - #validate_or_raise() | |
22 | - } | |
23 | - | |
24 | - ID =|> AST_BASE | |
25 | - } | |
26 | - | |
27 | - package MixIns #Gray { | |
28 | - | |
29 | - class MixIn_value_attribute<MixIn> { | |
30 | - _value | |
31 | - value() | |
32 | - } | |
33 | - | |
34 | - class MixIn_expr_attribute<MixIn> { | |
35 | - _expr | |
36 | - expr() | |
37 | - } | |
38 | - | |
39 | - class MixIn_children_tuple<MixIn> { | |
40 | - _children :Tuple | |
41 | - __len__() | |
42 | - __getitem__() | |
43 | - __iter__() | |
44 | - } | |
45 | - } | |
46 | - | |
47 | - package Peg #0077ff { | |
48 | - | |
49 | - abstract PEG | |
50 | - AST_BASE <|== PEG | |
51 | - | |
52 | - | |
53 | - | |
54 | - abstract Terminal | |
55 | - PEG <|== Terminal | |
56 | - MixIn_value_attribute <|... Terminal | |
57 | - Terminal <|== StrTerm | |
58 | - Terminal <|== RexExpTerm | |
59 | - Terminal <|== Number | |
60 | - | |
61 | - abstract Markers #Orange | |
62 | - annotation EOF #Orange | |
63 | - PEG <|== Markers | |
64 | - Markers <|== EOF | |
65 | - | |
66 | - abstract NonTerminal | |
67 | - PEG <|== NonTerminal | |
68 | - abstract Expression | |
69 | - NonTerminal <|== Expression | |
70 | - | |
71 | - class Setting { | |
72 | - name : ID | |
73 | - value | |
74 | - } | |
75 | - PEG <|== Setting | |
76 | - | |
77 | - class Rule { | |
78 | - name :ID | |
79 | - expr :[] Expression | |
80 | - } | |
81 | - NonTerminal <|== Rule | |
82 | - | |
83 | - interface Rules | |
84 | - PEG <|== Rules | |
85 | - MixIn_children_tuple <|... Rules | |
86 | - Rules <|== ParseRules | |
87 | - Rules <|== Settings | |
88 | - | |
89 | - class Grammar { | |
90 | - +all_rules :Rules | |
91 | - -parse_rules :ParseRules | |
92 | - -settings :Settings | |
93 | - } | |
94 | - NonTerminal <|== Grammar | |
95 | - | |
96 | - | |
97 | - abstract Group | |
98 | - Expression <|== Group | |
99 | - Group <|== UnorderedGroup | |
100 | - MixIn_expr_attribute <|... UnorderedGroup | |
101 | - abstract Quantity | |
102 | - Group <|== Quantity | |
103 | - MixIn_expr_attribute <|... Quantity | |
104 | - Expression <|== Sequence | |
105 | - MixIn_children_tuple <|... Sequence | |
106 | - | |
107 | - Expression <|== OrderedChoice | |
108 | - MixIn_children_tuple <|... OrderedChoice | |
109 | - | |
110 | - class Optional << (?, #0077ff) >> | |
111 | - Quantity <|== Optional | |
112 | - class ZeroOrMore << (*, #0077ff) >> | |
113 | - Quantity <|== ZeroOrMore | |
114 | - class OneOrMore << (+, #0077ff) >> | |
115 | - Quantity <|== OneOrMore | |
116 | - | |
117 | - abstract Predicate | |
118 | - Expression <|== Predicate | |
119 | - MixIn_expr_attribute <|... Predicate | |
120 | - class AndPredicate << (&, #0077ff) notconsuming >> | |
121 | - Predicate <|== AndPredicate | |
122 | - class NotPredicate << (! ,#0077ff) not consuming >> | |
123 | - Predicate <|== NotPredicate | |
124 | - | |
125 | - } | |
126 | - @enduml | |
127 | - | |
128 | - | |
129 | - | |
130 | - | |
131 | - | |
132 | - | |
133 | - | |
134 | - | |
135 | - | |
136 | - | |
137 | - | |
138 | - | |
139 | - |