about summary refs log tree commit diff stats
path: root/cpp/.traces/interpolate-works
blob: a9f9b7fb1e870fd5ffb3448cad1beb8941507227 (plain) (blame)
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
//: For convenience, allow Mu types to be abbreviated.

void test_type_abbreviations() {
  transform(
      "type foo = number\n"
      "def main [\n"
      "  a:foo <- copy 34\n"
      "]\n"
  );
  CHECK_TRACE_CONTENTS(
      "transform: product type after expanding abbreviations: \"number\"\n"
  );
}

:(before "End Globals")
map<string, type_tree*> Type_abbreviations, Type_abbreviations_snapshot;

//:: Defining type abbreviations.

:(before "End Command Handlers")
else if (command == "type") {
  load_type_abbreviations(in);
}

:(code)
void load_type_abbreviations(istream& in) {
  string new_type_name = next_word(in);
  assert(has_data(in) || !new_type_name.empty());
  if (!has_data(in) || new_type_name.empty()) {
    raise << "incomplete 'type' statement; must be of the form 'type <new type name> = <type expression>'\n" << end();
    return;
  }
  string arrow = next_word(in);
  assert(has_data(in) || !arrow.empty());
  if (arrow.empty()) {
    raise << "incomplete 'type' statement 'type " << new_type_name << "'\n" << end();
    return;
  }
  if (arrowpre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
parse/0: instruction: 36
parse/0:   ingredient: {name: "abc _", value: 0, type: 0, properties: ["abc _": "literal-string"]}
parse/0:   product: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character", "raw": ]}
parse/0: instruction: 36
parse/0:   ingredient: {name: "def", value: 0, type: 0, properties: ["def": "literal-string"]}
parse/0:   product: {name: "2", value: 0, type: 2-5-4, properties: ["2": "address":"array":"character", "raw": ]}
parse/0: instruction: 107
parse/0:   ingredient: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character", "raw": ]}
parse/0:   ingredient: {name: "2", value: 0, type: 2-5-4, properties: ["2": "address":"array":"character", "raw": ]}
parse/0:   product: {name: "3", value: 0, type: 2-5-4, properties: ["3": "address":"array":"character", "raw": ]}
parse/0: instruction: 1
parse/0:   ingredient: {name: "3", value: 0, type: 2-5-4, properties: ["3": "address":"array":"character", "raw": , "deref": ]}
parse/0:   product: {name: "4", value: 0, type: 5-4, properties: ["4": "array":"character", "raw": ]}
new/0: abc _ -> 0
new/0: def -> 0
after-brace/0: recipe test-interpolate-works
after-brace/0: new ...
after-brace/0: new ...
after-brace/0: interpolate ...
after-brace/0: copy ...
new/0: routine allocated memory from 1000 to 101000
schedule/0: test-interpolate-works
run/0: instruction test-interpolate-works/0
mem/0: storing 1000 in location 1
run/0: instruction test-interpolate-works/1
mem/0: storing 1006 in location 2
run/0: instruction test-interpolate-works/2
mem/0: location 1 is 1000
mem/0: location 2 is 1006
run/0: instruction interpolate/0
mem/0: array size is 60
mem/0: new alloc: 1010
run/0: instruction interpolate/1
run/0: product 0 is 1000
mem/0: storing 1000 in location 1012
run/0: instruction interpolate/2
mem/0: location 1012 is 1000
mem/0: storing 5 in location 1013
run/0: instruction interpolate/3
run/0: ingredient 0 is tem-len
mem/0: location 1013 is 5
mem/0: storing 5 in location 1014
run/0: instruction interpolate/5
run/0: product 0 is 1006
mem/0: storing 1006 in location 1015
mem/0: storing 1 in location 1016
run/0: instruction interpolate/6
mem/0: location 1016 is 1
run/0: ingredient 0 is 1
run/0: jump-unless fell through
run/0: instruction interpolate/7
mem/0: location 1015 is 1006
mem/0: storing 3 in location 1017
run/0: instruction interpolate/8
run/0: ingredient 0 is result-len
mem/0: location 1014 is 5
run/0: ingredient 1 is a-len
mem/0: location 1017 is 3
run/0: product 0 is 8
mem/0: storing 8 in location 1014
run/0: instruction interpolate/9
run/0: ingredient 0 is result-len
mem/0: location 1014 is 8
run/0: ingredient 1 is 1
run/0: product 0 is 7
mem/0: storing 7 in location 1014
run/0: instruction interpolate/10
run/0: ingredient 0 is -6
run/0: jumping to instruction 5
run/0: instruction interpolate/5
mem/0: storing 0 in location 1016
run/0: instruction interpolate/6
mem/0: location 1016 is 0
run/0: ingredient 0 is 0
run/0: ingredient 1 is 
run/0: jumping to instruction 11
run/0: instruction interpolate/12
run/0: instruction interpolate/13
run/0: product 0 is 1000
run/0: instruction interpolate/14
mem/0: location 1014 is 7
mem/0: array size is 7
mem/0: new alloc: 1070
mem/0: storing 1070 in location 1018
run/0: instruction interpolate/15
run/0: ingredient 0 is 0
mem/0: storing 0 in location 1019
run/0: instruction interpolate/16
run/0: ingredient 0 is 0
mem/0: storing 0 in location 1020
run/0: instruction interpolate/18
run/0: product 0 is 1006
mem/0: storing 1006 in location 1015
mem/0: storing 1 in location 1016
run/0: instruction interpolate/19
mem/0: location 1016 is 1
run/0: ingredient 0 is 1
run/0: jump-unless fell through
run/0: instruction interpolate/21
run/0: ingredient 0 is i
mem/0: location 1020 is 0
run/0: ingredient 1 is tem-len
mem/0: location 1013 is 5
run/0: product 0 is 0
mem/0: storing 0 in location 1021
run/0: instruction interpolate/22
mem/0: location 1021 is 0
run/0: ingredient 0 is 0
run/0: jump-if fell through
run/0: instruction interpolate/23
run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]}
mem/0: location 1012 is 1000
run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]}
mem/0: location 1020 is 0
run/0: address to copy is 1001
run/0: its type is 4
mem/0: location 1001 is 97
run/0: product 0 is 97
mem/0: storing 97 in location 1022
run/0: instruction interpolate/24
run/0: ingredient 0 is in
mem/0: location 1022 is 97
run/0: ingredient 1 is 95
run/0: product 0 is 0
mem/0: storing 0 in location 1023
run/0: instruction interpolate/25
mem/0: location 1023 is 0
run/0: ingredient 0 is 0
run/0: jump-if fell through
run/0: instruction interpolate/26
run/0: ingredient 0 is result
mem/0: location 1018 is 1070
run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]}
mem/0: location 1019 is 0
run/0: address to copy is 1071
run/0: product 0 is 1071
mem/0: storing 1071 in location 1024
run/0: instruction interpolate/27
run/0: ingredient 0 is in
mem/0: location 1022 is 97
mem/0: location 1024 is 1071
mem/0: storing 97 in location 1071
run/0: instruction interpolate/28
run/0: ingredient 0 is i
mem/0: location 1020 is 0
run/0: ingredient 1 is 1
run/0: product 0 is 1
mem/0: storing 1 in location 1020
run/0: instruction interpolate/29
run/0: ingredient 0 is result-idx
mem/0: location 1019 is 0
run/0: ingredient 1 is 1
run/0: product 0 is 1
mem/0: storing 1 in location 1019
run/0: instruction interpolate/30
run/0: ingredient 0 is -10
run/0: jumping to instruction 21
run/0: instruction interpolate/21
run/0: ingredient 0 is i
mem/0: location 1020 is 1
run/0: ingredient 1 is tem-len
mem/0: location 1013 is 5
run/0: product 0 is 0
mem/0: storing 0 in location 1021
run/0: instruction interpolate/22
mem/0: location 1021 is 0
run/0: ingredient 0 is 0
run/0: jump-if fell through
run/0: instruction interpolate/23
run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]}
mem/0: location 1012 is 1000
run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]}
mem/0: location 1020 is 1
run/0: address to copy is 1002
run/0: its type is 4
mem/0: location 1002 is 98
run/0: product 0 is 98
mem/0: storing 98 in location 1022
run/0: instruction interpolate/24
run/0: ingredient 0 is in
mem/0: location 1022 is 98
run/0: ingredient 1 is 95
run/0: product 0 is 0
mem/0: storing 0 in location 1023
run/0: instruction interpolate/25
mem/0: location 1023 is 0
run/0: ingredient 0 is 0
run/0: jump-if fell through
run/0: instruction interpolate/26
run/0: ingredient 0 is result
mem/0: location 1018 is 1070
run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]}
mem/0: location 1019 is 1
run/0: address to copy is 1072
run/0: product 0 is 1072
mem/0: storing 1072 in location 1024
run/0: instruction interpolate/27
run/0: ingredient 0 is in
mem/0: location 1022 is 98
mem/0: location 1024 is 1072
mem/0: storing 98 in location 1072
run/0: instruction interpolate/28
run/0: ingredient 0 is i
mem/0: location 1020 is 1
run/0: ingredient 1 is 1
run/0: product 0 is 2
mem/0: storing 2 in location 1020
run/0: instruction interpolate/29
run/0: ingredient 0 is result-idx
mem/0: location 1019 is 1
run/0: ingredient 1 is 1
run/0: product 0 is 2
mem/0: storing 2 in location 1019
run/0: instruction interpolate/30
run/0: ingredient 0 is -10
run/0: jumping to instruction 21
run/0: instruction interpolate/21
run/0: ingredient 0 is i
mem/0: location 1020 is 2
run/0: ingredient 1 is tem-len
mem/0: location 1013 is 5
run/0: product 0 is 0
mem/0: storing 0 in location 1021
run/0: instruction interpolate/22
mem/0: location 1021 is 0
run/0: ingredient 0 is 0
run/0: jump-if fell through
run/0: instruction interpolate/23
run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]}
mem/0: location 1012 is 1000
run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]}
mem/0: location 1020 is 2
run/0: address to copy is 1003
run/0: its type is 4
mem/0: location 1003 is 99
run/0: product 0 is 99
mem/0: storing 99 in location 1022
run/0: instruction interpolate/24
run/0: ingredient 0 is in
mem/0: location 1022 is 99
run/0: ingredient 1 is 95
run/0: product 0 is 0
mem/0: storing 0 in location 1023
run/0: instruction interpolate/25
mem/0: location 1023 is 0
run/0: ingredient 0 is 0
run/0: jump-if fell through
run/0: instruction interpolate/26
run/0: ingredient 0 is result
mem/0: location 1018 is 1070
run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]}
mem/0: location 1019 is 2
run/0: address to copy is 1073
run/0: product 0 is 1073
mem/0: storing 1073 in location 1024
run/0: instruction interpolate/27
run/0: ingredient 0 is in
mem/0: location 1022 is 99
mem/0: location 1024 is 1073
mem/0: storing 99 in location 1073
run/0: instruction interpolate/28
run/0: ingredient 0 is i
mem/0: location 1020 is 2
run/0: ingredient 1 is 1
run/0: product 0 is 3
mem/0: storing 3 in location 1020
run/0: instruction interpolate/29
run/0: ingredient 0 is result-idx
mem/0: location 1019 is 2
run/0: ingredient 1 is 1
run/0: product 0 is 3
mem/0: storing 3 in location 1019
run/0: instruction interpolate/30
run/0: ingredient 0 is -10
run/0: jumping to instruction 21
run/0: instruction interpolate/21
run/0: ingredient 0 is i
mem/0: location 1020 is 3
run/0: ingredient 1 is tem-len
mem/0: location 1013 is 5
run/0: product 0 is 0
mem/0: storing 0 in location 1021
run/0: instruction interpolate/22
mem/0: location 1021 is 0
run/0: ingredient 0 is 0
run/0: jump-if fell through
run/0: instruction interpolate/23
run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]}
mem/0: location 1012 is 1000
run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]}
mem/0: location 1020 is 3
run/0: address to copy is 1004
run/0: its type is 4
mem/0: location 1004 is 32
run/0: product 0 is 32
mem/0: storing 32 in location 1022
run/0: instruction interpolate/24
run/0: ingredient 0 is in
mem/0: location 1022 is 32
run/0: ingredient 1 is 95
run/0: product 0 is 0
mem/0: storing 0 in location 1023
run/0: instruction interpolate/25
mem/0: location 1023 is 0
run/0: ingredient 0 is 0
run/0: jump-if fell through
run/0: instruction interpolate/26
run/0: ingredient 0 is result
mem/0: location 1018 is 1070
run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]}
mem/0: location 1019 is 3
run/0: address to copy is 1074
run/0: product 0 is 1074
mem/0: storing 1074 in location 1024
run/0: instruction interpolate/27
run/0: ingredient 0 is in
mem/0: location 1022 is 32
mem/0: location 1024 is 1074
mem/0: storing 32 in location 1074
run/0: instruction interpolate/28
run/0: ingredient 0 is i
mem/0: location 1020 is 3
run/0: ingredient 1 is 1
run/0: product 0 is 4
mem/0: storing 4 in location 1020
run/0: instruction interpolate/29
run/0: ingredient 0 is result-idx
mem/0: location 1019 is 3
run/0: ingredient 1 is 1
run/0: product 0 is 4
mem/0: storing 4 in location 1019
run/0: instruction interpolate/30
run/0: ingredient 0 is -10
run/0: jumping to instruction 21
run/0: instruction interpolate/21
run/0: ingredient 0 is i
mem/0: location 1020 is 4
run/0: ingredient 1 is tem-len
mem/0: location 1013 is 5
run/0: product 0 is 0
mem/0: storing 0 in location 1021
run/0: instruction interpolate/22
mem/0: location 1021 is 0
run/0: ingredient 0 is 0
run/0: jump-if fell through
run/0: instruction interpolate/23
run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]}
mem/0: location 1012 is 1000
run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]}
mem/0: location 1020 is 4
run/0: address to copy is 1005
run/0: its type is 4
mem/0: location 1005 is 95
run/0: product 0 is 95
mem/0: storing 95 in location 1022
run/0: instruction interpolate/24
run/0: ingredient 0 is in
mem/0: location 1022 is 95
run/0: ingredient 1 is 95
run/0: product 0 is 1
mem/0: storing 1 in location 1023
run/0: instruction interpolate/25
mem/0: location 1023 is 1
run/0: ingredient 0 is 1
run/0: ingredient 1 is 
run/0: jumping to instruction 31
run/0: instruction interpolate/32
run/0: ingredient 0 is 0
mem/0: storing 0 in location 1025
run/0: instruction interpolate/34
run/0: ingredient 0 is j
mem/0: location 1025 is 0
run/0: ingredient 1 is a-len
mem/0: location 1017 is 3
run/0: product 0 is 0
mem/0: storing 0 in location 1026
run/0: instruction interpolate/35
mem/0: location 1026 is 0
run/0: ingredient 0 is 0
run/0: jump-if fell through
run/0: instruction interpolate/36
run/0: ingredient 0 is {name: "a", value: 4, type: 2-5-4, properties: ["a": "address":"array":"character", "deref": ]}
mem/0: location 1015 is 1006
run/0: ingredient 1 is {name: "j", value: 14, type: 1, properties: ["j": "integer"]}
mem/0: location 1025 is 0
run/0: address to copy is 1007
run/0: its type is 4
mem/0: location 1007 is 100
run/0: product 0 is 100
mem/0: storing 100 in location 1022
run/0: instruction interpolate/37
run/0: ingredient 0 is result
mem/0: location 1018 is 1070
run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]}
mem/0: location 1019 is 4
run/0: address to copy is 1075
run/0: product 0 is 1075
mem/0: storing 1075 in location 1024
run/0: instruction interpolate/38
run/0: ingredient 0 is in
mem/0: location 1022 is 100
mem/0: location 1024 is 1075
mem/0: storing 100 in location 1075
run/0: instruction interpolate/39
run/0: ingredient 0 is j
mem/0: location 1025 is 0
run/0: ingredient 1 is 1
run/0: product 0 is 1
mem/0: storing 1 in location 1025
run/0: instruction interpolate/40
run/0: ingredient 0 is result-idx
mem/0: location 1019 is 4
run/0: ingredient 1 is 1
run/0: product 0 is 5
mem/0: storing 5 in location 1019
run/0: instruction interpolate/41
run/0: ingredient 0 is -8
run/0: jumping to instruction 34
run/0: instruction interpolate/34
run/0: ingredient 0 is j
mem/0: location 1025 is 1
run/0: ingredient 1 is a-len
mem/0: location 1017 is 3
run/0: product 0 is 0
mem/0: storing 0 in location 1026
run/0: instruction interpolate/35
mem/0: location 1026 is 0
run/0: ingredient 0 is 0
run/0: jump-if fell through
run/0: instruction interpolate/36
run/0: ingredient 0 is {name: "a", value: 4, type: 2-5-4, properties: ["a": "address":"array":"character", "deref": ]}
mem/0: location 1015 is 1006
run/0: ingredient 1 is {name: "j", value: 14, type: 1, properties: ["j": "integer"]}
mem/0: location 1025 is 1
run/0: address to copy is 1008
run/0: its type is 4
mem/0: location 1008 is 101
run/0: product 0 is 101
mem/0: storing 101 in location 1022
run/0: instruction interpolate/37
run/0: ingredient 0 is result
mem/0: location 1018 is 1070
run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]}
mem/0: location 1019 is 5
run/0: address to copy is 1076
run/0: product 0 is 1076
mem/0: storing 1076 in location 1024
run/0: instruction interpolate/38
run/0: ingredient 0 is in
mem/0: location 1022 is 101
mem/0: location 1024 is 1076
mem/0: storing 101 in location 1076
run/0: instruction interpolate/39
run/0: ingredient 0 is j
mem/0: location 1025 is 1
run/0: ingredient 1 is 1
run/0: product 0 is 2
mem/0: storing 2 in location 1025
run/0: instruction interpolate/40
run/0: ingredient 0 is result-idx
mem/0: location 1019 is 5
run/0: ingredient 1 is 1
run/0: product 0 is 6
mem/0: storing 6 in location 1019
run/0: instruction interpolate/41
run/0: ingredient 0 is -8
run/0: jumping to instruction 34
run/0: instruction interpolate/34
run/0: ingredient 0 is j
mem/0: location 1025 is 2
run/0: ingredient 1 is a-len
mem/0: location 1017 is 3
run/0: product 0 is 0
mem/0: storing 0 in location 1026
run/0: instruction interpolate/35
mem/0: location 1026 is 0
run/0: ingredient 0 is 0
run/0: jump-if fell through
run/0: instruction interpolate/36
run/0: ingredient 0 is {name: "a", value: 4, type: 2-5-4, properties: ["a": "address":"array":"character", "deref": ]}
mem/0: location 1015 is 1006
run/0: ingredient 1 is {name: "j", value: 14, type: 1, properties: ["j": "integer"]}
mem/0: location 1025 is 2
run/0: address to copy is 1009
run/0: its type is 4
mem/0: location 1009 is 102
run/0: product 0 is 102
mem/0: storing 102 in location 1022
run/0: instruction interpolate/37
run/0: ingredient 0 is result
mem/0: location 1018 is 1070
run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]}
mem/0: location 1019 is 6
run/0: address to copy is 1077
run/0: product 0 is 1077
mem/0: storing 1077 in location 1024
run/0: instruction interpolate/38
run/0: ingredient 0 is in
mem/0: location 1022 is 102
mem/0: location 1024 is 1077
mem/0: storing 102 in location 1077
run/0: instruction interpolate/39
run/0: ingredient 0 is j
mem/0: location 1025 is 2
run/0: ingredient 1 is 1
run/0: product 0 is 3
mem/0: storing 3 in location 1025
run/0: instruction interpolate/40
run/0: ingredient 0 is result-idx
mem/0: location 1019 is 6
run/0: ingredient 1 is 1
run/0: product 0 is 7
mem/0: storing 7 in location 1019
run/0: instruction interpolate/41
run/0: ingredient 0 is -8
run/0: jumping to instruction 34
run/0: instruction interpolate/34
run/0: ingredient 0 is j
mem/0: location 1025 is 3
run/0: ingredient 1 is a-len
mem/0: location 1017 is 3
run/0: product 0 is 1
mem/0: storing 1 in location 1026
run/0: instruction interpolate/35
mem/0: location 1026 is 1
run/0: ingredient 0 is 1
run/0: ingredient 1 is 
run/0: jumping to instruction 42
run/0: instruction interpolate/43
run/0: ingredient 0 is i
mem/0: location 1020 is 4
run/0: ingredient 1 is 1
run/0: product 0 is 5
mem/0: storing 5 in location 1020
run/0: instruction interpolate/44
run/0: ingredient 0 is -27
run/0: jumping to instruction 18
run/0: instruction interpolate/18
mem/0: storing 0 in location 1016
run/0: instruction interpolate/19
mem/0: location 1016 is 0
run/0: ingredient 0 is 0
run/0: ingredient 1 is 
run/0: jumping to instruction 45
run/0: instruction interpolate/47
run/0: ingredient 0 is i
mem/0: location 1020 is 5
run/0: ingredient 1 is tem-len
mem/0: location 1013 is 5
run/0: product 0 is 1
mem/0: storing 1 in location 1021
run/0: instruction interpolate/48
mem/0: location 1021 is 1
run/0: ingredient 0 is 1
run/0: ingredient 1 is 
run/0: jumping to instruction 55
run/0: instruction interpolate/56
mem/0: location 1018 is 1070
run/0: result 0 is 1070
mem/0: storing 1070 in location 3
run/0: instruction test-interpolate-works/3
run/0: ingredient 0 is 3
mem/0: location 3 is 1070
mem/0: location 1070 is 7
mem/0: location 1071 is 97
mem/0: location 1072 is 98
mem/0: location 1073 is 99
mem/0: location 1074 is 32
mem/0: location 1075 is 100
mem/0: location 1076 is 101
mem/0: location 1077 is 102
mem/0: storing 7 in location 4
mem/0: storing 97 in location 5
mem/0: storing 98 in location 6
mem/0: storing 99 in location 7
mem/0: storing 32 in location 8
mem/0: storing 100 in location 9
mem/0: storing 101 in location 10
mem/0: storing 102 in location 11
/span>" ); CHECK_TRACE_CONTENTS( "transform: --- expand type abbreviations in recipe 'main'\n" "transform: ingredient type after expanding abbreviations: (\"address\" \"number\")\n" "transform: ingredient type after expanding abbreviations: (\"array\" \"number\")\n" "transform: ingredient type after expanding abbreviations: (\"address\" \"array\" \"number\")\n" "transform: ingredient type after expanding abbreviations: (\"address\" \"address\" \"array\" \"address\" \"array\" \"number\")\n" "transform: ingredient type after expanding abbreviations: (\"array\" (\"address\" \"number\") \"3\")\n" ); } :(before "Transform.push_back(update_instruction_operations)") Transform.push_back(expand_type_abbreviations); // idempotent // Begin Type Modifying Transforms // End Type Modifying Transforms :(code) void expand_type_abbreviations(const recipe_ordinal r) { expand_type_abbreviations(get(Recipe, r)); } void expand_type_abbreviations(const recipe& caller) { trace(101, "transform") << "--- expand type abbreviations in recipe '" << caller.name << "'" << end(); for (int i = 0; i < SIZE(caller.steps); ++i) { const instruction& inst = caller.steps.at(i); trace(102, "transform") << "instruction '" << to_original_string(inst) << end(); for (long int i = 0; i < SIZE(inst.ingredients); ++i) { expand_type_abbreviations(inst.ingredients.at(i).type); trace(102, "transform") << "ingredient type after expanding abbreviations: " << names_to_string(inst.ingredients.at(i).type) << end(); } for (long int i = 0; i < SIZE(inst.products); ++i) { expand_type_abbreviations(inst.products.at(i).type); trace(102, "transform") << "product type after expanding abbreviations: " << names_to_string(inst.products.at(i).type) << end(); } } // End Expand Type Abbreviations(caller) } void expand_type_abbreviations(type_tree* type) { if (!type) return; if (!type->atom) { expand_type_abbreviations(type->left); expand_type_abbreviations(type->right); return; } if (contains_key(Type_abbreviations, type->name)) *type = type_tree(*get(Type_abbreviations, type->name)); }