forked from jafingerhut/p4-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
p4-16-allowed-constructs.dot
169 lines (150 loc) · 7.68 KB
/
p4-16-allowed-constructs.dot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
digraph p4_16_allowed_construct_nesting {
node [shape=box];
rankdir=LR;
toplevel [label="top level"];
legend_bold_orange_box [label="Things inside dashed lines\nare either only allowed in,\nor most useful within,\narchitecture model files." style=dashed color=orange];
toplevel -> typeDeclaration;
typeDeclaration [label="type declarations for\nparser, control, package" style=dashed color=orange];
toplevel -> externDeclaration;
externDeclaration [label="extern function and\n object declarations" style=dashed color=orange];
toplevel -> parserDeclaration;
parserDeclaration [label="parser"];
toplevel -> constantDeclaration1;
constantDeclaration1 [label="const"];
toplevel -> typedefDeclaration;
typedefDeclaration [label="typedef"];
toplevel -> headerTypeDeclaration;
headerTypeDeclaration [label="header"];
toplevel -> headerUnionDeclaration;
headerUnionDeclaration [label="header_union"];
toplevel -> structTypeDeclaration;
structTypeDeclaration [label="struct"];
toplevel -> enumErrorMatchKindDeclaration;
enumErrorMatchKindDeclaration [label="enum\nerror\nmatch_kind"];
toplevel -> Instantiation;
Instantiation [label="instantiation of:\nextern object\nparser value set\npackage (there\nmust be one\ncalled 'main')"];
toplevel -> functionDefinition;
functionDefinition [label="function definition"];
toplevel -> actionDeclaration;
actionDeclaration [label="action"];
toplevel -> controlDeclaration;
controlDeclaration [label="control"];
// this is 'parser <name> (<parameters>) { ... }'
parserDeclaration -> constantOrVariableDeclaration2;
constantOrVariableDeclaration2 [label="const, variable decl"];
parserDeclaration -> Instantiation2;
Instantiation2 [label="instantiation of:\nextern object\nparser\nparser value set"];
parserDeclaration -> parserState;
parserState [label="state"];
parserState -> constantOrVariableDeclaration3;
constantOrVariableDeclaration3 [label="const, variable decl"];
parserState -> assignmentActionMethodCallStatement3;
assignmentActionMethodCallStatement3 [label="assignment\nfunction call\nNO: action call, if, switch\nextern object method call"];
parserState -> parserApplyCallStatement3;
parserApplyCallStatement3 [label="<subparser>.apply()"];
parserState -> blockStatement3;
blockStatement3 [label="block statement\n{ ... }"];
blockStatement3 -> blockStatementInParserState;
blockStatementInParserState [label="anything allowed\ndirectly inside state\nexcept transition,\nwhich must be last"];
parserState -> transitionStatement1;
parserState -> transitionStatement2;
transitionStatement1 [label="transition <statename>"];
transitionStatement2 [label="transition select ..."];
transitionStatement2 -> parserValueSetCall;
parserValueSetCall [label="parser value set\nas key set\nexpression"];
controlDeclaration -> constantOrVariableDeclaration4;
constantOrVariableDeclaration4 [label="const, variable decl"];
controlDeclaration -> Instantiation4;
Instantiation4 [label="instantiation of:\nextern object\ncontrol"];
controlDeclaration -> actionDeclaration;
controlDeclaration -> tableDeclaration;
controlDeclaration -> controlBody;
controlBody [label="control body\napply { }"];
tableDeclaration [label="table"];
tableDeclaration -> tablePropertyKey;
tablePropertyKey [label="key = { ... }"];
tableDeclaration -> tablePropertyActions;
tablePropertyActions [label="actions = { ... }"];
tableDeclaration -> tablePropertyDefaultAction;
tablePropertyDefaultAction [label="default_action = <action_name>;"];
functionDefinition -> constantOrVariableDeclaration7;
constantOrVariableDeclaration7 [label="const, variable decl"];
functionDefinition -> assignmentFunctionCallStatement1;
assignmentFunctionCallStatement1 [label="assignment\nfunction call\nreturn <expression>"];
functionDefinition -> conditionalStatement7;
conditionalStatement7 [label="if"];
conditionalStatement7 -> blockStatementInFunctionDefinition;
blockStatementInFunctionDefinition [label="anything allowed\ndirectly inside function"];
actionDeclaration -> constantOrVariableDeclaration5;
constantOrVariableDeclaration5 [label="const, variable decl"];
actionDeclaration -> assignmentActionMethodCallStatement5;
assignmentActionMethodCallStatement5 [label="assignment\nfunction call\naction call\nextern object method call"];
actionDeclaration -> returnOrExitStatement5;
returnOrExitStatement5 [label="return, exit"];
actionDeclaration -> conditionalStatement5;
conditionalStatement5 [label="if\n(language spec allows\nimplementations not to\nsupport 'if' inside actions)"];
conditionalStatement5 -> blockStatementInActionDeclaration;
actionDeclaration -> blockStatement5;
blockStatement5 [label="block statement\n{ ... }"];
blockStatement5 -> blockStatementInActionDeclaration;
blockStatementInActionDeclaration [label="anything allowed\ndirectly inside action"];
// I am making up actionCallStatement. It might most closely
// correspond in P4_16 grammar to assignmentOrMethodCallStatement.
//actionCallStatement
controlBody -> constantOrVariableDeclaration6;
constantOrVariableDeclaration6 [label="const, variable decl"];
controlBody -> assignmentActionMethodCallStatement6;
assignmentActionMethodCallStatement6 [label="assignment\nfunction call\naction call\nextern object method call"];
controlBody -> tableApplyCall6;
tableApplyCall6 [label="<table>.apply()"];
controlBody -> controlCallStatement6;
controlCallStatement6 [label="<control_name>.apply()"];
controlBody -> returnOrExitStatement6;
returnOrExitStatement6 [label="return, exit"];
controlBody -> switchStatement6;
switchStatement6 [label="switch (<table>.apply().action_run) { ... }"];
switchStatement6 -> blockStatementInControlBody;
controlBody -> conditionalStatement6;
conditionalStatement6 [label="if"];
conditionalStatement6 -> blockStatementInControlBody;
controlBody -> blockStatement6;
blockStatement6 [label="block statement\n{ ... }"];
blockStatement6 -> blockStatementInControlBody;
blockStatementInControlBody [label="anything allowed\ndirectly inside control body"];
legend_oval [label="Things inside\novals are types,\nwith arrow A->B if\ntype A can contain\ntype B as a member." shape=oval];
{
rank=same;
containerStructOrTuple [shape=oval label="struct or tuple"];
//containerStruct [shape=oval label="struct"];
//containerTuple [shape=oval label="tuple"];
containerHeaderUnion [shape=oval label="header_union"];
}
{
rank=same;
containerHeader [shape=oval label="header"];
}
{
rank=same;
elementBitW [shape=oval label="bit<W>"];
elementIntW [shape=oval label="int<W>"];
elementVarbitW [shape=oval label="varbit<W>"];
elementError [shape=oval label="error"];
elementBool [shape=oval label="bool"];
elementEnum [shape=oval label="enum"];
elementHeaderStack [shape=oval label="header stack"];
}
containerHeader -> elementBitW;
containerHeader -> elementIntW;
containerHeader -> elementVarbitW;
containerHeaderUnion -> containerHeader;
containerStructOrTuple -> elementBitW;
containerStructOrTuple -> elementIntW;
containerStructOrTuple -> elementVarbitW;
containerStructOrTuple -> elementError;
containerStructOrTuple -> elementBool;
containerStructOrTuple -> elementEnum;
containerStructOrTuple -> containerHeader;
containerStructOrTuple -> containerHeaderUnion;
containerStructOrTuple -> elementHeaderStack;
containerStructOrTuple -> containerStructOrTuple;
}