Mercurial > repos > rhope
annotate backendutils.rhope @ 92:e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 02 Aug 2010 00:58:55 -0400 |
parents | c25d75c2440b |
children | f51c4c17457c |
rev | line source |
---|---|
12
31f8182f3433
Finished fib test and did some small work on the c backend
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 |
35
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
2 Escape Rhope Name NU[name:escaped] |
12
31f8182f3433
Finished fib test and did some small work on the c backend
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 { |
92
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
4 escaped <- [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[name]Replace["_","UN_"] |
48
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
42
diff
changeset
|
5 ]Replace["@","AT_"] |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
42
diff
changeset
|
6 ]Replace[" ","SP_"] |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
42
diff
changeset
|
7 ]Replace[":","CN_"] |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
42
diff
changeset
|
8 ]Replace["?","QN_"] |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
42
diff
changeset
|
9 ]Replace["+","PL_"] |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
42
diff
changeset
|
10 ]Replace["-","MN_"] |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
42
diff
changeset
|
11 ]Replace["*","TM_"] |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
42
diff
changeset
|
12 ]Replace["/","DV_"] |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
42
diff
changeset
|
13 ]Replace["<","LT_"] |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
42
diff
changeset
|
14 ]Replace[">","GT_"] |
a24eb366195c
Fixed some bugs introduced in previous commit and moved definition of integer methods out of runtime and into the compiler
Mike Pavone <pavone@retrodev.com>
parents:
42
diff
changeset
|
15 ]Replace["(","LP_"] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
16 ]Replace[")","RP_"] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
17 ]Replace["!","NT_"] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
18 ]Replace["=","EQ_"] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
19 ]Replace["'","PR_"] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
20 ]Replace["\"","DP_"] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
21 ]Replace["\t","TB_"] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
22 ]Replace[",", "CM_"] |
75
0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents:
74
diff
changeset
|
23 ]Replace[".", "PD_"] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
24 ]Replace["\n", "NL_"] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
25 ]Replace["{", "LC_"] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
26 ]Replace["}", "RC_"] |
92
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
27 ]Replace["[", "LS_"] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
28 ]Replace["]", "RS_"] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
29 ]Replace["#", "HS_"] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
30 ]Replace["\\", "BS_"] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
31 ]Replace["\r", "CR_"] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
32 ]Replace[";", "SC_"] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
33 ]Replace["&", "AM_"] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
34 ]Replace["|", "PI_"] |
e73a93fb5de1
Beginning of port of compiler to itself, some bugfixes and a refcount optimization
Mike Pavone <pavone@retrodev.com>
parents:
90
diff
changeset
|
35 ]Replace["%", "PC_"] |
12
31f8182f3433
Finished fib test and did some small work on the c backend
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
36 } |
13 | 37 |
35
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
38 Escape Rhope Name[name:escaped] |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
39 { |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
40 escaped <- Escape Rhope Name NU[[name]Replace["_","__"]] |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
41 } |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
42 |
13 | 43 Blueprint AddRef |
44 { | |
45 Value | |
46 } | |
47 | |
48 AddRef[value:out] | |
49 { | |
50 out <- [Build["AddRef"]]Value <<[value] | |
51 } | |
52 | |
53 Make Op@AddRef[addref,func:out] | |
54 { | |
18
ea991f95ae1f
C backend working well enough to generate Fib test
Mike Pavone <pavone@retrodev.com>
parents:
13
diff
changeset
|
55 //TODO: Make me work with other backends |
49
3e20ed8959c4
Added initial FFI implementation, Array type and 64-bit integers
Mike Pavone <pavone@retrodev.com>
parents:
48
diff
changeset
|
56 out <- [["add_ref((object *)"]Append[ [[addref]Value >>]Make Op[func] ]]Append[")"] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
57 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
58 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
59 Strip Addref@AddRef[op:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
60 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
61 out <- [[op]Value >>]Strip Addref |
13 | 62 } |
63 | |
64 Make Op@String[string,func:out] | |
65 { | |
66 out <- [func]Resolve[string] | |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
67 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
68 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
69 Strip Addref@String[op:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
70 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
71 out <- op |
13 | 72 } |
73 | |
74 Make Op@Whole Number[num,func:out] | |
75 { | |
76 out <- num | |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
77 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
78 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
79 Strip Addref@Whole Number[op:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
80 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
81 out <- op |
13 | 82 } |
83 | |
84 Make Op@Real Number[num,func:out] | |
85 { | |
86 out <- num | |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
87 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
88 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
89 Strip Addref@Real Number[op:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
90 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
91 out <- op |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
92 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
93 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
94 Blueprint Output |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
95 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
96 Name |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
97 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
98 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
99 Output[name:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
100 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
101 out <- [Build["Output"]]Name <<[name] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
102 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
103 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
104 Make Op@Output[op,func:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
105 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
106 out <- [func]Resolve Output[[op]Name >>] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
107 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
108 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
109 Strip Addref@Output[op:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
110 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
111 out <- op |
13 | 112 } |
113 | |
114 Blueprint Constant | |
115 { | |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
116 Value |
74
a844c623c7df
Add support for Worker type
Mike Pavone <pavone@retrodev.com>
parents:
49
diff
changeset
|
117 Need Addref |
13 | 118 } |
119 | |
120 Constant[var:out] | |
121 { | |
74
a844c623c7df
Add support for Worker type
Mike Pavone <pavone@retrodev.com>
parents:
49
diff
changeset
|
122 out <- [[Build["Constant"]]Value <<[var]]Need Addref <<[Yes] |
13 | 123 } |
124 | |
125 Make Op@Constant[const,func:out] | |
126 { | |
74
a844c623c7df
Add support for Worker type
Mike Pavone <pavone@retrodev.com>
parents:
49
diff
changeset
|
127 out <- [func]Lookup Constant[[const]Value >>, [const]Need Addref >>] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
128 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
129 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
130 Strip Addref@Constant[op:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
131 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
132 out <- [op]Need Addref <<[No] |
13 | 133 } |
134 | |
135 Blueprint Result | |
136 { | |
137 Output Num | |
138 } | |
139 | |
140 Result[num:out] | |
141 { | |
142 out <- [Build["Result"]]Output Num <<[num] | |
143 } | |
144 | |
145 Make Op@Result[result,func:out] | |
146 { | |
147 out <- [func]Result Reference[[result]Output Num>>] | |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
148 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
149 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
150 Strip Addref@Result[op:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
151 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
152 out <- op |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
153 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
154 |
75
0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents:
74
diff
changeset
|
155 Blueprint Check Result |
0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents:
74
diff
changeset
|
156 { |
0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents:
74
diff
changeset
|
157 Output Num |
0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents:
74
diff
changeset
|
158 } |
0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents:
74
diff
changeset
|
159 |
0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents:
74
diff
changeset
|
160 Check Result[num:out] |
0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents:
74
diff
changeset
|
161 { |
0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents:
74
diff
changeset
|
162 out <- [Build["Check Result"]]Output Num <<[num] |
0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents:
74
diff
changeset
|
163 } |
0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents:
74
diff
changeset
|
164 |
0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents:
74
diff
changeset
|
165 Make Op@Check Result[result,func:out] |
0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents:
74
diff
changeset
|
166 { |
0083b2f7b3c7
Partially working implementation of List. Modified build scripts to allow use of other compilers. Fixed some bugs involving method implementations on different types returning different numbers of outputs. Added Fold to the 'builtins' in the comipler.
Mike Pavone <pavone@retrodev.com>
parents:
74
diff
changeset
|
167 out <- [func]Checked Result Reference[[result]Output Num>>] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
168 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
169 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
170 Strip Addref@Check Result[op:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
171 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
172 out <- op |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
173 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
174 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
175 Make Condition[op:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
176 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
177 If[[Type Of[op]]=["OrValue"]] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
178 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
179 out <- OrCond[Make Condition[[op]Left >>], Make Condition[[op]Right >>]] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
180 }{ |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
181 out <- op |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
182 } |
13 | 183 } |
184 | |
21
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
185 Blueprint OrValue |
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
186 { |
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
187 Left |
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
188 Right |
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
189 } |
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
190 |
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
191 OrValue[left,right:out] |
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
192 { |
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
193 out <- [[Build["OrValue"]]Left <<[left]]Right <<[right] |
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
194 } |
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
195 |
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
196 Make Op@OrValue[orval,func:out] |
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
197 { |
49
3e20ed8959c4
Added initial FFI implementation, Array type and 64-bit integers
Mike Pavone <pavone@retrodev.com>
parents:
48
diff
changeset
|
198 out <- [func]If Null Else[[orval]Left >>, [orval]Right >>] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
199 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
200 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
201 Strip Addref@OrValue[op:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
202 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
203 out <- [[op]Left <<[ [[op]Left >>]Strip Addref ]]Right <<[ [[op]Right >>]Strip Addref ] |
21
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
204 } |
e9272f7ebd26
Limited compilation from dataflow graph to C backend
Mike Pavone <pavone@retrodev.com>
parents:
18
diff
changeset
|
205 |
18
ea991f95ae1f
C backend working well enough to generate Fib test
Mike Pavone <pavone@retrodev.com>
parents:
13
diff
changeset
|
206 Blueprint NotCond |
ea991f95ae1f
C backend working well enough to generate Fib test
Mike Pavone <pavone@retrodev.com>
parents:
13
diff
changeset
|
207 { |
ea991f95ae1f
C backend working well enough to generate Fib test
Mike Pavone <pavone@retrodev.com>
parents:
13
diff
changeset
|
208 Condition |
ea991f95ae1f
C backend working well enough to generate Fib test
Mike Pavone <pavone@retrodev.com>
parents:
13
diff
changeset
|
209 } |
13 | 210 |
18
ea991f95ae1f
C backend working well enough to generate Fib test
Mike Pavone <pavone@retrodev.com>
parents:
13
diff
changeset
|
211 NotCond[cond:out] |
ea991f95ae1f
C backend working well enough to generate Fib test
Mike Pavone <pavone@retrodev.com>
parents:
13
diff
changeset
|
212 { |
49
3e20ed8959c4
Added initial FFI implementation, Array type and 64-bit integers
Mike Pavone <pavone@retrodev.com>
parents:
48
diff
changeset
|
213 out <- [Build["NotCond"]]Condition <<[[cond]Strip Addref] |
18
ea991f95ae1f
C backend working well enough to generate Fib test
Mike Pavone <pavone@retrodev.com>
parents:
13
diff
changeset
|
214 } |
ea991f95ae1f
C backend working well enough to generate Fib test
Mike Pavone <pavone@retrodev.com>
parents:
13
diff
changeset
|
215 |
ea991f95ae1f
C backend working well enough to generate Fib test
Mike Pavone <pavone@retrodev.com>
parents:
13
diff
changeset
|
216 Make Op@NotCond[cond,func:out] |
ea991f95ae1f
C backend working well enough to generate Fib test
Mike Pavone <pavone@retrodev.com>
parents:
13
diff
changeset
|
217 { |
ea991f95ae1f
C backend working well enough to generate Fib test
Mike Pavone <pavone@retrodev.com>
parents:
13
diff
changeset
|
218 out <- ["!"]Append[[[cond]Condition >>]Make Op[func]] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
219 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
220 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
221 Strip Addref@NotCond[op:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
222 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
223 out <- op |
18
ea991f95ae1f
C backend working well enough to generate Fib test
Mike Pavone <pavone@retrodev.com>
parents:
13
diff
changeset
|
224 } |
30
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
225 |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
226 Blueprint OrCond |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
227 { |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
228 Condition1 |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
229 Condition2 |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
230 } |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
231 |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
232 OrCond[cond1,cond2:out] |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
233 { |
49
3e20ed8959c4
Added initial FFI implementation, Array type and 64-bit integers
Mike Pavone <pavone@retrodev.com>
parents:
48
diff
changeset
|
234 out <- [[Build["OrCond"]]Condition1 <<[[cond1]Strip Addref]]Condition2 <<[[cond2]Strip Addref] |
30
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
235 } |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
236 |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
237 Make Op@OrCond[cond,func:out] |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
238 { |
37
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
239 out <- ["("]Append[[[ [[cond]Condition1 >>]Make Op[func] ]Append[" || "]]Append[[ [[cond]Condition2 >>]Make Op[func] ]Append[")"]]] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
240 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
241 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
242 Strip Addref@OrCond[op:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
243 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
244 out <- op |
30
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
245 } |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
246 |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
247 Blueprint AndCond |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
248 { |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
249 Condition1 |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
250 Condition2 |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
251 } |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
252 |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
253 AndCond[cond1,cond2:out] |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
254 { |
49
3e20ed8959c4
Added initial FFI implementation, Array type and 64-bit integers
Mike Pavone <pavone@retrodev.com>
parents:
48
diff
changeset
|
255 out <- [[Build["AndCond"]]Condition1 <<[[cond1]Strip Addref]]Condition2 <<[[cond2]Strip Addref] |
30
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
256 } |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
257 |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
258 Make Op@AndCond[cond,func:out] |
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
259 { |
37
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
260 out <- ["("]Append[[[ [[cond]Condition1 >>]Make Op[func] ]Append[" && "]]Append[[ [[cond]Condition2 >>]Make Op[func] ]Append[")"]]] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
261 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
262 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
263 Strip Addref@AndCond[op:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
264 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
265 out <- op |
30
914ad38f9b59
Compiler now works for some simple programs
Mike Pavone <pavone@retrodev.com>
parents:
21
diff
changeset
|
266 } |
35
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
267 |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
268 Blueprint Field Ref |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
269 { |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
270 Variable |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
271 Field |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
272 } |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
273 |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
274 Field Ref[var,field:out] |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
275 { |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
276 out <- [[Build["Field Ref"]]Variable <<[var]]Field <<[field] |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
277 } |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
278 |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
279 Make Op@Field Ref[ref,func:out] |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
280 { |
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
281 out <- [func]Field Result[[ref]Variable >>,[ref]Field >>] |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
282 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
283 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
284 Strip Addref@Field Ref[op:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
285 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
286 out <- op |
35
3498713c3dc9
C backend portion of supporting user defined types is done, but untested. Parser/NWorker still need a fair bit of work
Mike Pavone <pavone@retrodev.com>
parents:
30
diff
changeset
|
287 } |
37
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
288 |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
289 Blueprint Type Instance |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
290 { |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
291 Name |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
292 Params |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
293 Variant |
49
3e20ed8959c4
Added initial FFI implementation, Array type and 64-bit integers
Mike Pavone <pavone@retrodev.com>
parents:
48
diff
changeset
|
294 Mutable? |
37
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
295 } |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
296 |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
297 Type Instance[raw name:out] |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
298 { |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
299 If[[raw name]=[""]] |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
300 { |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
301 name <- "Any Type" |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
302 }{ |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
303 name <- raw name |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
304 } |
49
3e20ed8959c4
Added initial FFI implementation, Array type and 64-bit integers
Mike Pavone <pavone@retrodev.com>
parents:
48
diff
changeset
|
305 out <- [[[[Build["Type Instance"]]Name <<[name]]Params <<[()]]Variant <<["Boxed"]]Mutable? <<[No] |
37
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
306 } |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
307 |
42
aabda74c7a88
Fields can now be defined to have naked primitive types
Mike Pavone <pavone@retrodev.com>
parents:
38
diff
changeset
|
308 Set Variant@Type Instance[type,variant:out,invalid] |
37
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
309 { |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
310 [("Boxed","Naked","Pointer","Raw Pointer")]Find[variant] |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
311 { |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
312 out <- [type]Variant <<[variant] |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
313 }{ |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
314 invalid <- type |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
315 } |
640f541e9116
Added support for type declarations on user defined workers and added a few more methods to Int32 in the runtime for the C backend
Mike Pavone <pavone@retrodev.com>
parents:
36
diff
changeset
|
316 } |
42
aabda74c7a88
Fields can now be defined to have naked primitive types
Mike Pavone <pavone@retrodev.com>
parents:
38
diff
changeset
|
317 |
aabda74c7a88
Fields can now be defined to have naked primitive types
Mike Pavone <pavone@retrodev.com>
parents:
38
diff
changeset
|
318 =@Type Instance[type,compare:out] |
aabda74c7a88
Fields can now be defined to have naked primitive types
Mike Pavone <pavone@retrodev.com>
parents:
38
diff
changeset
|
319 { |
aabda74c7a88
Fields can now be defined to have naked primitive types
Mike Pavone <pavone@retrodev.com>
parents:
38
diff
changeset
|
320 If[[Type Of[compare]] = ["String"]] |
aabda74c7a88
Fields can now be defined to have naked primitive types
Mike Pavone <pavone@retrodev.com>
parents:
38
diff
changeset
|
321 { |
aabda74c7a88
Fields can now be defined to have naked primitive types
Mike Pavone <pavone@retrodev.com>
parents:
38
diff
changeset
|
322 out <- [[type]Name >>] = [compare] |
aabda74c7a88
Fields can now be defined to have naked primitive types
Mike Pavone <pavone@retrodev.com>
parents:
38
diff
changeset
|
323 }{ |
aabda74c7a88
Fields can now be defined to have naked primitive types
Mike Pavone <pavone@retrodev.com>
parents:
38
diff
changeset
|
324 //TODO: Compare parameters |
aabda74c7a88
Fields can now be defined to have naked primitive types
Mike Pavone <pavone@retrodev.com>
parents:
38
diff
changeset
|
325 ,out <- If[[[type]Name >>] = [[compare]Name >>]] |
aabda74c7a88
Fields can now be defined to have naked primitive types
Mike Pavone <pavone@retrodev.com>
parents:
38
diff
changeset
|
326 { out <- [[type]Variant >>] = [[compare]Variant >>] } |
aabda74c7a88
Fields can now be defined to have naked primitive types
Mike Pavone <pavone@retrodev.com>
parents:
38
diff
changeset
|
327 } |
90
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
328 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
329 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
330 Blueprint Worker Literal |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
331 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
332 Name |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
333 Args |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
334 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
335 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
336 Worker Literal[name:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
337 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
338 out <- [[Build["Worker Literal"]]Name <<[name]]Args <<[()] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
339 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
340 |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
341 Set Input@Worker Literal[worker,argnum,val:out] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
342 { |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
343 out <- [worker]Args <<[ [[worker]Args >>]Set[argnum, val] ] |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
344 } |
c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
Mike Pavone <pavone@retrodev.com>
parents:
75
diff
changeset
|
345 |