Mercurial > repos > icfp2013
annotate src/bv.tp @ 3:dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 08 Aug 2013 21:54:02 -0700 |
parents | |
children | 538440e1c3d2 |
rev | line source |
---|---|
3
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 program <- { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 _input <- 0i64 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 _zero <- #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 string <- { "0" } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 eval <- { 0i64 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 _one <- #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 string <- { "1" } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 eval <- { 1i64 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 _inputNode <- #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 string <- { "input" } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 eval <- { _input } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 plus <- :left right { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 string <- { "(plus " . (string: left) . " " . (string: right) . ")" } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 eval <- { (eval: left) + (eval: right)} |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 zero <- { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 _zero |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
27 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
28 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
29 one <- { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
30 _one |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
31 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
32 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 opAnd <- :left right { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
34 #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
35 string <- { "(and " . (string: left) . " " . (string: right) . ")" } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
36 eval <- { (eval: left) and (eval: right)} |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
37 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
38 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
39 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
40 opOr <- :left right { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
41 #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
42 string <- { "(or " . (string: left) . " " . (string: right) . ")" } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
43 eval <- { (eval: left) or (eval: right)} |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
44 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
45 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
46 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
47 opXor <- :left right { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
48 #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
49 string <- { "(xor " . (string: left) . " " . (string: right) . ")" } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
50 eval <- { (eval: left) xor (eval: right)} |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
51 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
52 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
53 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
54 opNot <- :exp { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
55 #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
56 string <- { "(not " . (string: exp) . ")" } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
57 eval <- { (eval: exp) xor -1 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
58 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
59 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
60 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
61 shl1 <- :exp { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
62 #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
63 string <- { "(shl1 " . (string: exp) . ")" } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
64 eval <- { lshift: (eval: exp) by: 1 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
65 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
66 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
67 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
68 shr1 <- :exp { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
69 #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
70 string <- { "(shr1 " . (string: exp) . ")" } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
71 eval <- { rshift: (eval: exp) by: 1 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
72 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
73 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
74 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
75 shr4 <- :exp { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
76 #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
77 string <- { "(shr4 " . (string: exp) . ")" } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
78 eval <- { rshift: (eval: exp) by: 4 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
79 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
80 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
81 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
82 shr16 <- :exp { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
83 #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
84 string <- { "(shr16 " . (string: exp) . ")" } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
85 eval <- { rshift: (eval: exp) by: 16 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
86 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
87 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
88 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
89 input <- { _inputNode } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
90 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
91 if0:then:else <- :exp ifzero :ifnotzero { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
92 #{ |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
93 string <- { "(if0 " . (string: exp) . " " . (string: ifzero) . " " . (string: ifnotzero) . ")" } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
94 eval <- { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
95 if: (eval: exp) = 0i64 { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
96 eval: ifzero |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
97 } else: { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
98 eval: ifnotzero |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
99 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
100 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
101 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
102 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
103 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
104 run <- :in { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
105 _input <- in |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
106 eval: root |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
107 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
108 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
109 root <- _zero |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
110 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
111 string <- { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
112 "(lambda (input) " . (string: root) . ")" |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
113 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
114 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
115 gentestprog <- { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
116 root <- if0: (opAnd: input one) then: ( |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
117 plus: (opOr: input (shl1: one)) |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
118 ) else: ( |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
119 opXor: input (shr16: input) |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
120 ) |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
121 self |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
122 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
123 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
124 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
125 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
126 test <- { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
127 prog <- program gentestprog |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
128 print: (string: prog) . "\n" |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
129 vals <- #[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0x30001 0x50015] |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
130 foreach: vals :idx val { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
131 print: "p(0x" . (hex: val) . ") = 0x" . (hex: (prog run: val)) . "\n" |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
132 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
133 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
134 |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
135 main <- { |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
136 test: |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
137 } |
dfc5f00c94bc
Initial evaluator implementation. fold is currently missing but other ops are present and seem to work
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
138 } |