Mercurial > repos > rhope
annotate dict.rhope @ 131:0a4682be2db2
Modify lexer and new parser to work in compiler
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 05 Nov 2010 02:43:34 +0000 |
parents | c9974ac32369 |
children | f3686f60985d |
rev | line source |
---|---|
83
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 Blueprint Empty Dictionary |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 { |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 Blueprint Dictionary |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 { |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 Left |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 Right |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 Straight |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 Bits(UInt32,Naked) |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 Dictionary[:out] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 { |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 out <- Build[Empty Dictionary()] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 _Index@Empty Dictionary[dict,index,bits,bitindex:out,not found] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 { |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 not found <- dict |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 Index@Empty Dictionary[dict,index:out,not found] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 { |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 not found <- dict |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
27 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
28 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
29 _Terminal Node[val:out] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
30 { |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
31 out <- [[[[Build[Dictionary()] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
32 ]Left <<[Dictionary[]] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 ]Right <<[Dictionary[]] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
34 ]Straight <<[val] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
35 ]Bits <<[0u32] |
83
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
36 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
37 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
38 _Set New[index,val,bits,bitindex:out] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
39 { |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
40 nbitindex <- [bitindex]+[1] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
41 [index]Dict Bits[nbitindex] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
42 { straight <- _Set New[index,val,[~]+[1u32],nbitindex] } |
83
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
43 { straight <- _Terminal Node[val] } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
44 out <- [[[[Build[Dictionary()]]Left <<[Dictionary[]]]Right <<[Dictionary[]]]Straight <<[straight]]Bits <<[bits] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
45 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
46 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
47 _Set@Empty Dictionary[dict,index,val,bits,bitindex:out] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
48 { |
99
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
49 If[[bits]=[0u32]] |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
50 { |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
51 out <- _Terminal Node[val] |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
52 }{ |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
53 out <- _Set New[index,val,bits,bitindex] |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
54 } |
83
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
55 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
56 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
57 Set@Empty Dictionary[dict,index,val:out] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
58 { |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
59 out <- _Set New[index,val, [Dict Type ID[index]]+[1u32], -1] |
83
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
60 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
61 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
62 First@Empty Dictionary[dict:first,not found] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
63 { |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
64 not found <- dict |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
65 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
66 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
67 Next@Empty Dictionary[dict,index:next,not found] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
68 { |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
69 not found <- dict |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
70 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
71 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
72 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
73 Index@Dictionary[dict,index:out,not found] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
74 { |
99
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
75 |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
76 out,not found <- [dict]_Index[index,[Dict Type ID[index]]+[1u32], -1] |
83
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
77 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
78 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
79 _Index@Dictionary[dict,index,bits,bitindex:out,not found] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
80 { |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
81 If[[bits]=[[dict]Bits >>]] |
99
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
82 { |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
83 If[[bits]=[0u32]] |
83
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
84 { |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
85 out <- Straight >>[dict] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
86 }{ |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
87 nbitindex <- [bitindex]+[1] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
88 [index]Dict Bits[nbitindex] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
89 { nbits <- [~]+[1u32] } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
90 { nbits <- 0u32 } |
83
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
91 out,not found <- [[dict]Straight >>]_Index[index,nbits,nbitindex] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
92 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
93 }{ |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
94 If[[bits]<[[dict]Bits >>]] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
95 { |
87
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
96 go <- Left >>[dict] |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
97 }{ |
83
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
98 go <- Right >>[dict] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
99 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
100 out,not found <- [go]_Index[index,bits,bitindex] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
101 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
102 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
103 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
104 Set@Dictionary[dict,index,val:out] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
105 { |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
106 out <- [dict]_Set[index,val,[Dict Type ID[index]]+[1u32], -1] |
83
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
107 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
108 |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
109 _Set@Dictionary[dict,index,val,bits,bitindex:out] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
110 { |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
111 If[[bits]=[[dict]Bits >>]] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
112 { |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
113 If[[bits]=[0u32]] |
83
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
114 { |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
115 out <- [dict]Straight <<[val] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
116 }{ |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
117 nbitindex <- [bitindex]+[1] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
118 [index]Dict Bits[nbitindex] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
119 { nbits <- [~]+[1u32] } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
120 { nbits <- 0u32 } |
83
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
121 out <- [dict]Straight <<[[[dict]Straight >>]_Set[index,val,nbits,nbitindex]] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
122 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
123 }{ |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
124 If[[bits]<[[dict]Bits >>]] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
125 { |
87
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
126 go <- Left >>[dict] |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
127 out <- [dict]Left <<[new] |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
128 }{ |
83
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
129 go <- Right >>[dict] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
130 out <- [dict]Right <<[new] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
131 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
132 new <- [go]_Set[index,val,bits,bitindex] |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
133 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
134 } |
27bb051d631c
Initial implementation of Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
135 |
87
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
136 _First Type ID@Empty Dictionary[dict:typeid,node,none] |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
137 { |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
138 none <- dict |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
139 } |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
140 |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
141 _First Type ID@Dictionary[dict:typeid,node] |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
142 { |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
143 typeid,node <- [[dict]Left >>]_First Type ID {} {} |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
144 { |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
145 typeid <- [[dict]Bits >>]-[1u32] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
146 node <- Straight >>[dict] |
87
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
147 } |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
148 } |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
149 |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
150 _First@Empty Dictionary[dict,keylist:keyout,none] |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
151 { |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
152 none <- dict |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
153 } |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
154 |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
155 _First@Dictionary[dict,keylist:keyout] |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
156 { |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
157 keyout <- [[dict]Left >>]_First[keylist] {} |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
158 { |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
159 If[[[dict]Bits >>] = [0u32]] |
87
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
160 { |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
161 keyout <- keylist |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
162 }{ |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
163 keyout <- [[dict]Straight >>]_First[[keylist]Append[[[dict]Bits >>]-[1u32]]] |
87
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
164 } |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
165 } |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
166 } |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
167 |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
168 First@Dictionary[dict:out,none] |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
169 { |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
170 typeid, node <- [dict]_First Type ID |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
171 rawkey <- [node]_First[List[]] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
172 out <- [Build[Blueprint From ID[typeid]]]From Dict Key[rawkey] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
173 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
174 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
175 Next@Dictionary[dict,cur:out,none] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
176 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
177 [cur]Dict Type ID |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
178 { rawkey,typeid,none <- [dict]_Next Type ID[[~]+[1u32], cur] } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
179 |
87
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
180 out <- [Build[Blueprint From ID[typeid]]]From Dict Key[rawkey] |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
181 } |
3c4325e6298f
Add First@Dictionary (need to find mem man bug)
Mike Pavone <pavone@retrodev.com>
parents:
83
diff
changeset
|
182 |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
183 _Next@Empty Dictionary[dict:out,none] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
184 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
185 none <- dict |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
186 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
187 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
188 _Next Type ID@Empty Dictionary[dict:out,typeid,none] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
189 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
190 none <- dict |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
191 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
192 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
193 _Next Type ID@Dictionary[dict,curtypeid,key:out,typeid,none] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
194 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
195 If[[[dict]Bits >>]=[curtypeid]] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
196 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
197 out <- [[dict]Straight >>]_Next[key,0,List[]] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
198 { typeid <- [curtypeid]-[1u32] } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
199 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
200 typeid,,none <- [[dict]Right >>]_First Type ID {} |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
201 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
202 l <- List[] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
203 out <- [~]_First[l] {} |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
204 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
205 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
206 }{ |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
207 If[[curtypeid]<[[dict]Bits >>]] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
208 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
209 out,typeid <- [[dict]Left >>]_Next Type ID[curtypeid,key] {} {} |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
210 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
211 typeid <- [curtypeid]-[1u32] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
212 out <- [[dict]Straight >>]_First[List[]] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
213 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
214 }{ |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
215 out,typeid,none <- [[dict]Right >>]_Next Type ID[curtypeid,key] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
216 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
217 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
218 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
219 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
220 _Next@Dictionary[dict,key,keyidx,newkey:out,none] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
221 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
222 [key]Dict Bits[keyidx] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
223 { bits <- [~]+[1u32] } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
224 { bits <- 0u32 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
225 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
226 If[[[dict]Bits >>]=[bits]] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
227 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
228 ,goright <- If[bits] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
229 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
230 out,goright <- [[dict]Straight >>]_Next[key,[keyidx]+[1], [newkey]Append[[bits]-[1u32]]] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
231 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
232 Val[goright] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
233 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
234 out,none <- [[dict]Right >>]_First[newkey] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
235 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
236 }{ |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
237 If[[bits]<[[dict]Bits >>]] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
238 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
239 out <- [[dict]Left >>]_Next[key, keyidx, newkey] {} |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
240 { out <- [[dict]Straight >>]_First[[newkey]Append[[[dict]Bits >>]-[1u32]]] } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
241 }{ |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
242 out,none <- [[dict]Right >>]_Next[key, keyidx, newkey] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
243 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
244 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
245 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
246 |
99
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
247 _String Seq[str,val,key:out] |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
248 { |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
249 out <- [[[[str |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
250 ]Append["\n\t"] |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
251 ]Append[String[key]] |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
252 ]Append[":\t"] |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
253 ]Append[String[val]] |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
254 } |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
255 |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
256 |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
257 String@Dictionary[dict:out] |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
258 { |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
259 out <- Fold[_String Seq[?], "Dictionary", dict] |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
260 } |
e09c2d1d6d5b
Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents:
97
diff
changeset
|
261 |
97 | 262 _Print Seq[dict,key:out] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
263 { |
129
c9974ac32369
Improve Dictionary pretty printing slightly
Mike Pavone <pavone@retrodev.com>
parents:
99
diff
changeset
|
264 val <- [[String[[dict]Index[key]]]Split["\n"]]Join["\n\t"] |
92
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
265 Print[ [[["\t"]Append[String[key]]]Append[":\t"]]Append[val] ] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
266 { |
97 | 267 ,out <- [dict]Next[key] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
268 { |
97 | 269 out <- _Print Seq[dict, ~] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
270 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
271 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
272 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
273 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
274 Print@Dictionary[dict:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
275 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
276 Print["Dictionary"] |
97 | 277 { out <- _Print Seq[dict, [dict]First] } |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
278 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
279 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
280 Print@Empty Dictionary[dict:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
281 { |
97 | 282 out <- Print["Dictionary\n\t{Empty}"] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
283 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
87
diff
changeset
|
284 |
92
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
285 Length@Empty Dictionary[dict:out] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
286 { |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
287 out <- 0 |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
288 } |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
289 |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
290 Length@Dictionary[dict:out] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
291 { |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
292 If[[dict]Bits >>] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
293 { |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
294 out <- [Length[[dict]Straight >>]]+[[Length[[dict]Left >>]] + [Length[[dict]Right >>]]] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
295 }{ |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
296 out <- [1]+[[Length[[dict]Left >>]] + [Length[[dict]Right >>]]] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
297 } |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
298 } |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
299 |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
300 _Combine[source,dest,key:out] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
301 { |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
302 new dest <- [dest]Set[key, [source]Index[key]] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
303 [source]Next[key] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
304 { |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
305 out <- _Combine[source, new dest, ~] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
306 }{ |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
307 out <- Val[new dest] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
308 } |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
309 } |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
310 |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
311 Combine[source,dest:out] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
312 { |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
313 [source]First |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
314 { |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
315 out <- _Combine[source, dest, ~] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
316 }{ |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
317 out <- dest |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
318 } |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
319 } |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
320 |