annotate backendutils_c.rhope @ 178:ed322ae64738

Detect duplicates in conditions
author Mike Pavone <pavone@retrodev.com>
date Wed, 15 Jun 2011 01:18:28 -0700
parents fd06fb07762a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1
109
b7df624895b2 Hack to reduce overhead of Escape Rhope Name
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
2 Escape Rhope Name[name,p:out]
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
3 {
109
b7df624895b2 Hack to reduce overhead of Escape Rhope Name
Mike Pavone <pavone@retrodev.com>
parents: 100
diff changeset
4 escaped <- [name]Replace[p,
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
5 ("UN_","AT_","SP_","CN_","QN_","PL_","MN_","TM_","DV_","LT_","GT_","LP_","RP_","NT_","EQ_","PR_",
100
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 99
diff changeset
6 "DP_","TB_","CM_","PD_","NL_","LC_","RC_", "LS_", "RS_", "HS_", "BS_", "CR_", "SC_", "AM_", "PI_", "PC_", "CT_", "BT_", "TD_")]
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 99
diff changeset
7
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 99
diff changeset
8 [("char","int","short","long","float","double","void","struct")]Find[=[escaped, ?]]
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 99
diff changeset
9 {
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 99
diff changeset
10 out <- ["ID_"]Append[escaped]
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 99
diff changeset
11 }{
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 99
diff changeset
12 out <- Val[escaped]
f51c4c17457c Broken port of parser to compiler
Mike Pavone <pavone@retrodev.com>
parents: 99
diff changeset
13 }
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
14 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
16 Blueprint Make Op Res
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
17 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
18 Func
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
19 Val
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
20 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
21
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
22 Make Op Res[func,val:out]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
23 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
24 out <- [[Build[Make Op Res()]]Func <<[func]]Val <<[val]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
25 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
26
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
27 Make Op Mod[func,val:out func,out val]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
28 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
29 nval <- [val]Make Op[func]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
30 If[[Blueprint Of[nval]]=[Make Op Res()]]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
31 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
32 out func <- Func >>[nval]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
33 out val <- Val >>[nval]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
34 }{
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
35 out func <- func
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
36 out val <- Val[nval]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
37 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
38 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
39
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
40 Blueprint AddRef
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
41 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
42 Value
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
43 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
44
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
45 AddRef[value:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
46 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
47 out <- [Build[AddRef()]]Value <<[value]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
48 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
49
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
50 Make Op@AddRef[addref,func:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
51 {
136
fc3815b7462f Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents: 135
diff changeset
52 out <- [func]Make AddRef Op[[addref]Value >>]
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
53 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
54
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
55 Strip Addref@AddRef[op:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
56 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
57 out <- [[op]Value >>]Strip Addref
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
58 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
59
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
60 =@AddRef[a,b(AddRef):out]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
61 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
62 out <- [[a]Value >>]==[[b]Value >>]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
63 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
64
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
65 Make Op@String[string,func:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
66 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
67 out <- [func]Resolve[string]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
68 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
69
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
70 Strip Addref@String[op:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
71 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
72 out <- op
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
73 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
74
135
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
75 Get Type@String[op,func:out]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
76 {
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
77 out <- [func]Get Var Type[op]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
78 }
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
79
99
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
80 Make Op@String Cat[string,func:out]
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
81 {
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
82 out <- [func]Resolve[string]
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
83 }
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
84
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
85 Strip Addref@String Cat[op:out]
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
86 {
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
87 out <- op
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
88 }
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
89
135
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
90 Get Type@String Cat[op,func:out]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
91 {
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
92 out <- [func]Get Var Type[op]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
93 }
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
94
99
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
95 Make Op@String Slice[string,func:out]
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
96 {
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
97 out <- [func]Resolve[string]
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
98 }
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
99
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
100 Strip Addref@String Slice[op:out]
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
101 {
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
102 out <- op
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
103 }
e09c2d1d6d5b Got dataflow graph code working in compiler (nworker_c.rhope)
Mike Pavone <pavone@retrodev.com>
parents: 92
diff changeset
104
135
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
105 Get Type@String Slice[op,func:out]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
106 {
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
107 out <- [func]Get Var Type[op]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
108 }
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
109
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
110 Blueprint Output
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
111 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
112 Name
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
113 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
114
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
115 Output[name:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
116 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
117 out <- [Build[Output()]]Name <<[name]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
118 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
119
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
120 Make Op@Output[op,func:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
121 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
122 out <- [func]Resolve Output[[op]Name >>]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
123 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
124
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
125 Strip Addref@Output[op:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
126 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
127 out <- op
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
128 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
129
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
130 =@Output[a,b(Output):out]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
131 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
132 out <- [[a]Name >>]=[[b]Name >>]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
133 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
134
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
135
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
136 Blueprint Constant
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
137 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
138 Value
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
139 Need Addref
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
140 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
141
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
142 Constant[var:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
143 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
144 out <- [[Build[Constant()]]Value <<[var]]Need Addref <<[Yes]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
145 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
146
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
147 Make Op@Constant[const,func:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
148 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
149 out <- [func]Lookup Constant[[const]Value >>, [const]Need Addref >>]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
150 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
151
135
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
152 Get Type@Constant[const,func:out]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
153 {
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
154 out <- [func]Get Constant Type[const]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
155 }
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
156
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
157 Strip Addref@Constant[op:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
158 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
159 out <- [op]Need Addref <<[No]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
160 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
161
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
162 =@Constant[a,b(Constant):out]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
163 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
164 out <- [[a]Value >>]=[[b]Value >>]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
165 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
166
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
167 Blueprint Result
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
168 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
169 Output Num
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
170 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
171
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
172 Result[num:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
173 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
174 out <- [Build[Result()]]Output Num <<[num]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
175 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
176
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
177 Make Op@Result[result,func:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
178 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
179 out <- [func]Result Reference[[result]Output Num>>]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
180 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
181
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
182 Strip Addref@Result[op:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
183 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
184 out <- op
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
185 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
186
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
187 =@Result[a,b(Result):out]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
188 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
189 out <- [[a]Output Num >>]=[[b]Output Num >>]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
190 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
191
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
192 Blueprint Global Get
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
193 {
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
194 Store
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
195 Var
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
196 }
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
197
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
198 Global Get[store,var:out]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
199 {
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
200 out <- [[Build[Global Get()]]Store <<[store]]Var <<[var]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
201 }
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
202
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
203 Make Op@Global Get[get,func:out]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
204 {
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
205 out <- [func]Global Reference[[get]Store >>, [get]Var >>]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
206 }
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
207
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
208 Strip Addref@Global Get[get:out]
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
209 {
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
210 out <- get
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
211 }
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 136
diff changeset
212
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
213 =@Global Get[a,b(Global Get):out]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
214 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
215 ,out <- If[[[a]Store >>]=[[b]Store >>]]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
216 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
217 out <- [[a]Var >>]=[[b]Var >>]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
218 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
219 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
220
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
221 Blueprint Check Result
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
222 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
223 Output Num
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
224 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
225
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
226 Check Result[num:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
227 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
228 out <- [Build[Check Result()]]Output Num <<[num]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
229 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
230
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
231 Make Op@Check Result[result,func:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
232 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
233 out <- [func]Checked Result Reference[[result]Output Num>>]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
234 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
235
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
236 Strip Addref@Check Result[op:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
237 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
238 out <- op
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
239 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
240
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
241 Make Condition[op:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
242 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
243 If[[Blueprint Of[op]]=[OrValue()]]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
244 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
245 out <- OrCond[Make Condition[[op]Left >>], Make Condition[[op]Right >>]]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
246 }{
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
247 out <- op
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
248 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
249 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
250
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
251 =@Check Result[a,b(Check Result):out]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
252 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
253 out <- [[a]Output Num >>]=[[b]Output Num >>]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
254 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
255
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
256 Blueprint OrValue
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
257 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
258 Left
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
259 Right
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
260 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
261
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
262 OrValue[left,right:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
263 {
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
264 If[[left]==[right]]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
265 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
266 out <- left
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
267 }{
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
268 out <- [[Build[OrValue()]]Left <<[left]]Right <<[right]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
269 }
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
270 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
271
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
272 Make Op@OrValue[orval,func:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
273 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
274 out <- [func]If Null Else[[orval]Left >>, [orval]Right >>]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
275 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
276
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
277 Strip Addref@OrValue[op:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
278 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
279 out <- [[op]Left <<[ [[op]Left >>]Strip Addref ]]Right <<[ [[op]Right >>]Strip Addref ]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
280 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
281
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
282 =@OrValue[a,b(OrValue):out]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
283 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
284 ,out <- If[[[a]Left >>]==[[b]Left >>]]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
285 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
286 out <- [[a]Right >>]==[[b]Right >>]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
287 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
288 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
289
169
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
290 Blueprint Cast
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
291 {
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
292 Value
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
293 Type
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
294 }
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
295
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
296 Cast[val,type:out]
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
297 {
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
298 out <- [[Build[Cast()]]Value <<[val]]Type <<[type]
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
299 }
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
300
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
301 Make Op@Cast[cast,func:out]
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
302 {
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
303 out <- [func]Cast Value[[cast]Value >>, [cast]Type >>]
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
304 }
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
305
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
306 Strip Addref@Cast[op:out]
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
307 {
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
308 out <- [op]Value <<[[[op]Value >>]Strip Addref]
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
309 }
fd06fb07762a Basic inlining of arithmetic and comparison operations on integer types
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
310
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
311 =@Cast[a,b(Cast):out]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
312 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
313 ,out <- If[[[a]Value >>] == [[b]Value >>]]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
314 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
315 out <- [[a]Type >>]=[[b]Type >>]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
316 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
317 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
318
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
319 Blueprint NotCond
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
320 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
321 Condition
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
322 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
323
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
324 NotCond[cond:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
325 {
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
326 If[[Blueprint Of[cond]]=[NotCond()]]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
327 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
328 out <- [cond]Condition >>
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
329 }{
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
330 out <- [Build[NotCond()]]Condition <<[[cond]Strip Addref]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
331 }
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
332 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
333
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
334 Make Op@NotCond[cond,func:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
335 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
336 out <- ["!"]Append[[[cond]Condition >>]Make Op[func]]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
337 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
338
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
339 Strip Addref@NotCond[op:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
340 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
341 out <- op
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
342 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
343
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
344 =@NotCond[a,b(NotCond):out]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
345 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
346 out <- [[a]Condition >>]==[[b]Condition >>]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
347 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
348
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
349 Blueprint OrCond
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
350 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
351 Condition1
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
352 Condition2
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
353 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
354
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
355 OrCond[cond1,cond2:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
356 {
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
357 If[[cond1]==[cond2]]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
358 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
359 out <- cond1
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
360 }{
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
361 out <- [[Build[OrCond()]]Condition1 <<[[cond1]Strip Addref]]Condition2 <<[[cond2]Strip Addref]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
362 }
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
363 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
364
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
365 Make Op@OrCond[cond,func:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
366 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
367 out <- ["("]Append[[[ [[cond]Condition1 >>]Make Op[func] ]Append[" || "]]Append[[ [[cond]Condition2 >>]Make Op[func] ]Append[")"]]]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
368 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
369
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
370 Strip Addref@OrCond[op:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
371 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
372 out <- op
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
373 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
374
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
375 =@OrCond[a,b(OrCond):out]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
376 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
377 ,out <- If[[[a]Condition1 >>] == [[b]Condition1 >>]]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
378 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
379 out <- [[a]Condition2 >>] == [[b]Condition2 >>]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
380 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
381 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
382
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
383 Blueprint AndCond
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
384 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
385 Condition1
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
386 Condition2
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
387 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
388
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
389 AndCond[cond1,cond2:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
390 {
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
391 If[[cond1]==[cond2]]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
392 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
393 out <- cond1
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
394 }{
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
395 out <- [[Build[AndCond()]]Condition1 <<[[cond1]Strip Addref]]Condition2 <<[[cond2]Strip Addref]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
396 }
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
397 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
398
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
399 Make Op@AndCond[cond,func:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
400 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
401 out <- ["("]Append[[[ [[cond]Condition1 >>]Make Op[func] ]Append[" && "]]Append[[ [[cond]Condition2 >>]Make Op[func] ]Append[")"]]]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
402 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
403
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
404 Strip Addref@AndCond[op:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
405 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
406 out <- op
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
407 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
408
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
409 =@AndCond[a,b(AndCond):out]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
410 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
411 ,out <- If[[[a]Condition1 >>] == [[b]Condition1 >>]]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
412 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
413 out <- [[a]Condition2 >>] == [[b]Condition2 >>]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
414 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
415 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
416
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
417 Blueprint Field Ref
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
418 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
419 Variable
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
420 Field
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
421 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
422
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
423 Field Ref[var,field:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
424 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
425 out <- [[Build[Field Ref()]]Variable <<[var]]Field <<[field]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
426 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
427
135
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
428 Get Type@Field Ref[ref,func:out]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
429 {
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
430 out <- [func]Get Field Type[[[ref]Variable >>]Get Type[func], [ref]Field >>]
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
431 }
18a4403fe576 Javascript backend can now produce broken output. Needs fixes plus port of standard lib
Mike Pavone <pavone@retrodev.com>
parents: 109
diff changeset
432
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
433 Make Op@Field Ref[ref,func:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
434 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
435 out <- [func]Field Result[[ref]Variable >>,[ref]Field >>]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
436 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
437
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
438 Strip Addref@Field Ref[op:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
439 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
440 out <- op
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
441 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
442
178
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
443 =@Field Ref[a,b(Field Ref):out]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
444 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
445 ,out <- If[[[a]Variable >>]==[[b]Variable >>]]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
446 {
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
447 out <- [[a]Field >>]=[[b]Field >>]
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
448 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
449 }
ed322ae64738 Detect duplicates in conditions
Mike Pavone <pavone@retrodev.com>
parents: 169
diff changeset
450
92
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
451 Blueprint Type Instance
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
452 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
453 Name
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
454 Params
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
455 Variant
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
456 Mutable?
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
457 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
458
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
459 Type Instance[raw name:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
460 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
461 If[[raw name]=[""]]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
462 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
463 name <- "Any Type"
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
464 }{
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
465 name <- raw name
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
466 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
467 out <- [[[[Build[Type Instance()]]Name <<[name]]Params <<[()]]Variant <<["Boxed"]]Mutable? <<[No]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
468 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
469
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
470 Set Variant@Type Instance[type,variant:out,invalid]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
471 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
472 [("Boxed","Naked","Pointer","Raw Pointer")]Find[=[variant,?]]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
473 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
474 out <- [type]Variant <<[variant]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
475 }{
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
476 invalid <- type
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
477 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
478 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
479
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
480 =@Type Instance[type,compare:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
481 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
482 If[[Blueprint Of[compare]] = [Type Instance()]]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
483 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
484 //TODO: Compare parameters
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
485 ,out <- If[[[type]Name >>] = [[compare]Name >>]]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
486 { out <- [[type]Variant >>] = [[compare]Variant >>] }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
487 }{
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
488 out <- [[type]Name >>] = [compare]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
489 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
490 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
491
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
492 String@Type Instance[type:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
493 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
494 typestr <- [[[[type]Name >>
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
495 ]Append["("]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
496 ]Append[ [[type]Params >>]Join[", "] ]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
497 ]Append[")"]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
498 If[[type]Mutable? >>]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
499 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
500 out <- [[ [["("]Append[typestr]]Append[", "] ]Append[[type]Variant >>]]Append[", Mutable)"]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
501 }{
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
502 If[[[type]Variant >>] = ["Boxed"]]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
503 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
504 out <- Val[typestr]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
505 }{
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
506 out <- [[ [["("]Append[typestr]]Append[", "] ]Append[[type]Variant >>]]Append[", Mutable)"]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
507 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
508 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
509 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
510
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
511 Blueprint Worker Literal
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
512 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
513 Name
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
514 Args
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
515 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
516
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
517 Worker Literal[name:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
518 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
519 out <- [[Build[Worker Literal()]]Name <<[name]]Args <<[()]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
520 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
521
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
522 Set Input@Worker Literal[worker,argnum,val:out]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
523 {
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
524 out <- [worker]Args <<[ [[worker]Args >>]Set[argnum, val] ]
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
525 }
e73a93fb5de1 Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
526