about summary refs log tree commit diff stats
path: root/cpp/014boolean
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-02-19 17:02:20 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-02-19 17:02:20 -0800
commitd7e112371c97b8d9e7b4ea4451071f8914b9b57f (patch)
tree7aebbf6dc45e853ea077db7b1721352b19bc85fe /cpp/014boolean
parente2d57bfec90a578d6545dff0059cc6050d21c573 (diff)
downloadmu-d7e112371c97b8d9e7b4ea4451071f8914b9b57f.tar.gz
792
Diffstat (limited to 'cpp/014boolean')
-rw-r--r--cpp/014boolean28
1 files changed, 28 insertions, 0 deletions
diff --git a/cpp/014boolean b/cpp/014boolean
index 66499b7f..87ea6e2f 100644
--- a/cpp/014boolean
+++ b/cpp/014boolean
@@ -66,3 +66,31 @@ recipe main [
 +mem: location 2 is 0
 +run: product 0 is 1
 +mem: storing in location 3
+
+:(before "End Globals")
+const int NOT = 9;
+:(before "End Primitive Recipe Numbers")
+Recipe_number["not"] = NOT;
+Next_recipe_number++;
+:(before "End Primitive Recipe Implementations")
+case NOT: {
+  trace("run") << "ingredient 0 is " << p->ingredients[0].name;
+  vector<int> arg0 = read_memory(p->ingredients[0]);
+  assert(arg0.size() == 1);
+  vector<int> result;
+  result.push_back(!arg0[0]);
+  trace("run") << "product 0 is " << result[0];
+  write_memory(p->products[0], result);
+  break;
+}
+
+:(scenario "not")
+recipe main [
+  1:integer <- copy 1:literal
+  2:integer <- not 1:integer
+]
++run: instruction 1
++run: ingredient 0 is 1
++mem: location 1 is 1
++run: product 0 is 0
++mem: storing in location 2
+0100 Update' href='/crystal/www/commit/index.html?id=6d33064f4122d5ab62019c590f4da704880a094a'>6d33064 ^
8163599 ^


a565af2
a1019e3 ^
252ba21 ^
a565af2


8163599 ^


4774210 ^
8163599 ^


85f992c ^
451634c ^
85f992c ^


8163599 ^


a1019e3 ^
451634c ^
a1019e3 ^


85f992c ^
8163599 ^


85f992c ^
8163599 ^


4774210 ^



25b5f6d ^

4774210 ^


a565af2
4774210 ^
a565af2


791e4bc ^
4774210 ^


8163599 ^


4774210 ^
252ba21 ^
a565af2

252ba21 ^




15f75c8 ^
252ba21 ^
a565af2

252ba21 ^
a565af2


252ba21 ^
a565af2


252ba21 ^
a565af2


4774210 ^
8163599 ^


a565af2
252ba21 ^
a565af2


8163599 ^
252ba21 ^
a565af2



8163599 ^


a565af2







252ba21 ^
1c9ba55 ^
0ce8800 ^
f1daa05 ^










c60b7aa ^
0cd9dc1 ^
e949cf0 ^
252ba21 ^

a565af2

8163599 ^


a565af2
252ba21 ^
a565af2

6119a90 ^
8163599 ^
6119a90 ^



8163599 ^
6119a90 ^
9bdf06b ^
6119a90 ^
a565af2
9bdf06b ^

a565af2



8163599 ^






a565af2



8163599 ^
a565af2

9bdf06b ^
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