Mercurial > hg > Papers > 2012 > aplas
annotate paper/rectype.ind @ 39:09cd9c5c7c40
modify conclution
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 16 Jun 2012 02:39:18 +0900 |
parents | 34a726a5c0d4 |
children | 4b828672f6b9 |
rev | line source |
---|---|
11 | 1 -title: Recursive type syntax in Continuation based C |
2 | |
32 | 3 \newcommand{\rectype}{{\tt \_\_rectype}} |
11 | 4 |
32 | 5 --author: Nobuyasu Oshiro, Shinji KONO |
11 | 6 |
7 --abstract: | |
32 | 8 |
11 | 9 We have implemented Continuation based C (CbC). |
10 CbC is an extension of C, which has parameterized goto statement. | |
11 It is useful for finite state automaton or many core tasks. | |
12 Goto statement is a way to force tail call elimination. | |
13 The destination of goto statement is called Code Segment, which is actually a normal function of C. | |
14 To represent recursive function call, the type system of C is not enough, because | |
15 it has no recursive types. | |
16 We introduce \rectype keyword for recursive type, and it is implemented in GCC-4.6.0. | |
17 We will compare the conventional methods, \rectype keyword and a method using C structure. | |
18 Also we show usage of CbC and it's benchmark. | |
19 | |
32 | 20 --Motivation |
21 | |
37 | 22 The C programming language is used in many practical programs, operating system |
23 kernels, byte code machines, network servers or embeded systems. Low level feature | |
24 of C is useful, but sometimes it requres programming hacks. For example, in case of | |
25 byte code machine often entire program is a huge switch statement which has many | |
26 labels which corespond the byte codes. Operating system or network server has | |
27 many layers such as system call dispatch, transport or presentation layer. It | |
28 requires deep call levels, 2 or 3 for each layer, resulting 10-30 call levels. | |
32 | 29 |
37 | 30 Continuation based C (CbC) provids a structured way to represent these situations. It |
31 is a small modication of C. It consists of a syntax to force tail-call-elimation | |
32 and parametarized goto statement. | |
33 | |
34 C has capable of recursive functions, but we find it's type system is not enough | |
35 to represent CbC programming. In this paper, we introduce \rectype | |
36 keyward as a recursive type. To handle recursive type, conventionally tagged struct | |
37 is used. It is also fit for CbC program. | |
38 | |
39 We will describe the CbC and \rectype implementation of CbC on GCC 4.6.0. | |
11 | 40 |
41 --Continuation based C | |
42 | |
28 | 43 CbC's basic programming unit is a Code Segment. It is not a subroutine, but it |
11 | 44 looks like a function, because it has input and output. We can use C struct |
45 as input and output interfaces. | |
46 | |
47 struct interface1 { int i; }; | |
48 struct interface2 { int o; }; | |
49 | |
50 __code f(struct interface1 a) { | |
51 struct interface2 b; b.o=a.i; | |
52 goto g(b); | |
53 } | |
54 | |
28 | 55 In this example, a Code Segment |
56 \verb+f+ has \verb+input a+ and sends \verb+output b+ to a Code Segment \verb+g+. | |
57 There is no return from Code Segment \verb+b+, \verb+b+ should call another | |
11 | 58 continuation using \verb+goto+. Any control structure in C is allowed in CwC |
59 language, but in case of CbC, we restrict ourselves to use \verb+if+ statement | |
60 only, because it is sufficient to implement C to CbC translation. In this case, | |
28 | 61 Code Segment has one input interface and several output interfaces (fig.\ref{code}). |
11 | 62 |
30 | 63 <center><img src="figure/code.pdf" alt="code"></center> |
11 | 64 |
65 | |
66 \verb+__code+ and parameterized global goto statement is an extension of | |
67 Continuation based C. Unlike \verb+C--+ \cite{cminusminus}'s parameterized goto, | |
68 we cannot goto into normal C function. | |
69 | |
28 | 70 In CwC, we can go to a Code Segment from a C function and we can call C functions |
71 in a Code Segment. So we don't have to shift completely from C to CbC. The later | |
11 | 72 one is straight forward, but the former one needs further extensions. |
73 | |
74 void *env; | |
75 __code (*exit)(int); | |
76 | |
77 __code h(char *s) { | |
78 printf(s); | |
79 goto (*exit)(0),env; | |
80 } | |
81 | |
82 int main() { | |
83 env = __environment; | |
84 exit = __return; | |
85 goto h("hello World\n"); | |
86 } | |
87 | |
88 In this hello world example, the environment of \verb+main()+ | |
89 and its continuation is kept in global variables. The environment | |
90 and the continuation can be get using \verb+__environment+, | |
28 | 91 and \verb+__return+. Arbitrary mixture of Code Segments and functions |
11 | 92 are allowed (in CwC). The continuation of \verb+goto+ statement |
93 never returns to original function, but it goes to caller of original | |
94 function. In this case, it returns result 0 to the operating system. | |
95 | |
96 | |
97 | |
14 | 98 --Recursive type syntax |
99 | |
37 | 100 A continuation is a pointer to a Code Segment to be executed after. |
101 For example, it is passed as follows; | |
14 | 102 |
103 __code csA( __code (*p)() ) { | |
104 goto p(csB); | |
105 } | |
106 | |
37 | 107 where {\tt p} is the continuation and {\tt csB} is a Code Segment which |
108 has the same type of {\tt csA}. This declaration is not enough because | |
109 it lacks the type of the argument. If add the type declaration, we | |
110 get following program; | |
14 | 111 |
37 | 112 __code csA( __code (*p)( __code (*)( __code (*)( __code (*)())))) { |
14 | 113 goto p(csB); |
114 } | |
115 | |
37 | 116 or |
26
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
117 __code csA( __code (*p)( __code(*)())) { |
15
68d2c32f74cf
modify explanation of rectype syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
14
diff
changeset
|
118 goto p(csB); |
68d2c32f74cf
modify explanation of rectype syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
14
diff
changeset
|
119 } |
68d2c32f74cf
modify explanation of rectype syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
14
diff
changeset
|
120 |
37 | 121 It is enough to type {\csB}, but of course it is not completly wll typed. |
122 Omitting types of the arguments of a function is allowed, but it requires | |
123 complex declaration and it is imcomplete. | |
15
68d2c32f74cf
modify explanation of rectype syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
14
diff
changeset
|
124 |
37 | 125 We introduce \rectype syntax for this situation. In an argument declation, |
126 \rectype represents it's fuction type. Using \rectype, previous example can | |
127 be written like this; | |
11 | 128 |
129 __code csA( __rectype *p) { | |
130 goto p(csB); | |
131 } | |
132 | |
37 | 133 {\tt *p} has a type of {\tt csA} itself. |
134 | |
135 The same situation is happen in convetional C, since Code Segment is a | |
136 mere C function with tail-call-elimination. \rectype provides exact and | |
137 concise way to describe recursive type. If we have extra arguments, | |
138 | |
139 __code csBs(int a, __rectype *p) ; | |
140 | |
141 __code csAs(int a, __rectype *p) { | |
142 goto p(a, csBs); | |
143 } | |
144 | |
145 In this case, we have two \rectype keywords. It may points the same type or | |
146 different types. There is no ambiguity here, because it point the exact | |
147 position. If it points the same position in the same type declaration, | |
148 it is the same type. | |
149 | |
11 | 150 |
38 | 151 --Recursive type syntax in a function body |
11 | 152 |
38 | 153 \rectype can be appeared in a function arguments, a function body or struct definition as a |
154 pointer type, otherwise it errors. | |
155 | |
156 In a function body, it has a type of the function itself. | |
157 | |
158 __code csAs(int a, __rectype *p) { | |
159 __rectype *p1 = p; | |
160 goto p1(a, csBs); | |
161 } | |
162 | |
163 It is possible to write the following way; | |
164 | |
165 __code csAs(int a, __rectype *p) { | |
166 __code (*p)(int, __retype *); | |
167 p1 = p; | |
168 goto p1(a, csBs); | |
169 } | |
11 | 170 |
38 | 171 but previous one is shorter. |
11 | 172 |
38 | 173 We cannot allow non pointer type \rectype, because it generates infinite size of object. |
174 | |
175 In case of struct, | |
176 | |
177 struct { | |
178 int a; | |
179 __rectype *next; | |
180 } | |
181 | |
182 is the same of this; | |
183 | |
184 struct b { | |
185 int a; | |
186 struct b *next; | |
187 } | |
188 | |
189 this is a conventional way to represent recursive type in C. Using this technique we | |
190 can write a continuation like this; | |
13 | 191 |
192 struct interface { | |
193 __code (*next)(struct interface); | |
194 }; | |
195 | |
196 __code csA(struct interface p) { | |
197 struct interface ds = { csB }; | |
38 | 198 goto p.next(ds); } |
13 | 199 |
200 int main() { | |
201 struct interface ds = { print }; | |
202 goto csA(ds); | |
38 | 203 /* NOTREACHED*/ |
13 | 204 return 0; |
205 } | |
206 | |
38 | 207 \rectype is clearer but struct technique provides abstract representation. It requres |
208 extra struct declation, but it give us the same assembler output. | |
13 | 209 |
210 __code fibonacci(__rectype *p, int num, int count, int result, int prev) | |
211 | |
212 | |
24 | 213 --How to implement \rectype |
11 | 214 |
29 | 215 \rectype syntax is implemented overriding AST. |
24 | 216 First, \rectype syntax make Tree same \code(\ref{fig:tree1}). |
217 Second, tree was created to be rectype flag. | |
29 | 218 Third, to override AST(\ref{fig:tree2}). |
24 | 219 |
220 \begin{figure}[htpb] | |
30 | 221 \begin{minipage}{0.5\hsize} |
222 \begin{center} | |
24 | 223 \scalebox{0.35}{\includegraphics{figure/tree1.pdf}} |
30 | 224 \end{center} |
225 \caption{AST of function pointer} | |
226 \label{fig:tree1} | |
227 \end{minipage} | |
228 \begin{minipage}{0.2\hsize} | |
229 \begin{center} | |
24 | 230 \scalebox{0.35}{\includegraphics{figure/tree2.pdf}} |
30 | 231 \end{center} |
232 \caption{AST of \rectype} | |
233 \label{fig:tree2} | |
24 | 234 \end{minipage} |
235 \end{figure} | |
236 | |
237 This AST(\ref{fig:tree2}) is made by syntax of \verb+__code csA(__rectype *p)+ . | |
30 | 238 \treelist have infomation of argument. |
239 First \treelist represent that argument is function pointer(\verb+__code (*p)()+) . | |
240 Second \treelist represent that csA is Fixed-length argument. | |
241 First \treelist is connected with \pointertype. | |
242 \pointertype have pointer of function(\functiontype). | |
24 | 243 We have to override it in the pointer of csA. |
244 | |
245 | |
246 | |
247 | |
21 | 248 --Problems with implementation of \rectype. |
33 | 249 |
21 | 250 Segmentation fault has occurred in the following program on compile. |
251 | |
252 __code csA(__rectype *p) { | |
253 goto p(3); | |
254 } | |
255 | |
256 The above code is the wrong argument of p. | |
22 | 257 The p's argument is converted by GCC. |
28 | 258 3 of type int is converted to a pionter type of Code Segment. |
22 | 259 At this time, GCC looks at the type of the argument. |
260 p's argument is pointer of csA. | |
261 csA's argument is p. | |
262 GCC is also an infinite recursion happens to see the type of tye argument of the argument. | |
263 | |
23 | 264 We Solve this problem that does not check the arguments if the \rectype flag is true. |
265 The following program become part was fixed gcc/c-family/c-pretty-print.c. | |
266 | |
267 static void | |
268 pp_c_abstract_declarator (c_pretty_printer *pp, tree t) | |
269 { | |
270 if (TREE_CODE (t) == POINTER_TYPE) | |
271 { | |
272 if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE | |
273 || TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE) | |
274 pp_c_right_paren (pp); | |
275 #ifndef noCbC | |
276 if (IS_RECTYPE(t)) return; | |
277 #endif | |
278 t = TREE_TYPE (t); | |
279 } | |
280 pp_direct_abstract_declarator (pp, t); | |
281 } | |
282 | |
283 | |
284 Variable t have information of p's argument. | |
30 | 285 If t is \pointertype, t is assigned type of \pointertype(\verb+t = TREE_TYPE (t);+). |
23 | 286 We have added code \verb+if (IS_RECTYPE(t)) return;+ |
287 Thereby we have solved type checking and infinite recursion problem. | |
21 | 288 |
289 | |
290 | |
291 | |
11 | 292 --Method other than \rectype |
293 | |
18
33b7a54edaa9
method other rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
17
diff
changeset
|
294 The recursively program of C's syntax can be solved using struct syntax. |
33b7a54edaa9
method other rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
17
diff
changeset
|
295 For example, if we write |
33b7a54edaa9
method other rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
17
diff
changeset
|
296 |
11 | 297 struct interface { |
298 __code (*next)(struct interface); | |
299 }; | |
300 | |
301 __code csA(struct interface p) { | |
18
33b7a54edaa9
method other rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
17
diff
changeset
|
302 struct interface ds; |
33b7a54edaa9
method other rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
17
diff
changeset
|
303 ds.next = csB; |
11 | 304 goto p.next(ds); |
305 } | |
306 | |
307 int main() { | |
18
33b7a54edaa9
method other rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
17
diff
changeset
|
308 struct interface ds; |
33b7a54edaa9
method other rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
17
diff
changeset
|
309 ds = print; |
11 | 310 goto csA(ds); |
311 return 0; | |
312 } | |
313 | |
18
33b7a54edaa9
method other rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
17
diff
changeset
|
314 there is no need to write recursively. |
33b7a54edaa9
method other rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
17
diff
changeset
|
315 Because the struct syntax wrapped in a function pointer. |
28 | 316 Code Segment does not receive function pointer in arguments. |
18
33b7a54edaa9
method other rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
17
diff
changeset
|
317 Recursively program does not occur. |
11 | 318 |
319 | |
26
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
320 --Comparison |
11 | 321 |
26
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
322 Here is CbC program that finds the Fibonacci sequence. |
11 | 323 |
26
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
324 __code print(__rectype *p, long int num, |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
325 long int count, long int result, long int prev) { |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
326 printf("fibonacci(%d) = %ld\n",num,result); |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
327 goto cs_while(print, num, count, result, prev); |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
328 } |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
329 |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
330 __code fibonacci(__rectype *p, long int num, |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
331 long int count, long int result, long int prev) { |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
332 if (count == 0) { |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
333 result += 0; |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
334 count++; |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
335 } else if (count == 1) { |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
336 result += 1; |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
337 count++; |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
338 } else if (count > 1){ |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
339 long int tmp = prev; |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
340 prev = result; |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
341 result = result + tmp; |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
342 count++; |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
343 } else { |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
344 printf("please enter nutural number\n"); |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
345 exit(0); |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
346 } |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
347 if (num < count) { |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
348 goto p(fibonacci, num, count, result, prev); |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
349 } |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
350 goto fibonacci(p, num, count, result, prev); |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
351 } |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
352 __code cs_while(__rectype *p, long int num, |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
353 long int count, long int result, long int prev) { |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
354 if (num > 0) { |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
355 num--; |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
356 goto fibonacci(print, num, 0, 0, 0); |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
357 } |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
358 exit(0); |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
359 } |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
360 |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
361 It is written using \rectype syntax. |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
362 Do not use the \rectype syntax program would be the following declaration. |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
363 |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
364 __code print(__code (*p)(__code(*)(),long int,long int,long int,long int), |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
365 long int num, long int count, long int result, long int prev); |
28 | 366 |
26
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
367 __code fibonacci(__code (*p)(__code(*)(),long int,long int, long int,long int), |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
368 long int num, long int count, long int result, long int prev); |
28 | 369 |
26
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
370 __code cs_while(__code (*p)(__code(*)(),long int, long int, long int, long int), |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
371 long int num, long int count, long int result, long int prev); |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
372 |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
373 Comparing the program that made the declaration of each. |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
374 AST is almost the same should be created both. |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
375 Therefore, there should be no difference was the result. |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
376 |
680becde8c9f
modify coparison
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
25
diff
changeset
|
377 Here is the result. |
19
dc62dc1fe059
modify compression
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
378 |
dc62dc1fe059
modify compression
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
379 --Conclusion |
39
09cd9c5c7c40
modify conclution
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
380 |
09cd9c5c7c40
modify conclution
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
381 |
09cd9c5c7c40
modify conclution
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
382 We have designed and implemented Continuation based language for practical use. |
09cd9c5c7c40
modify conclution
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
383 We have implemented \rectype syntax in GCC for CbC. |
09cd9c5c7c40
modify conclution
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
384 Thereby Easily be able to write CbC program than previous. |
09cd9c5c7c40
modify conclution
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
385 |
09cd9c5c7c40
modify conclution
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
386 This \rectype implementation may be other problems. |
09cd9c5c7c40
modify conclution
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
387 If so, it is necessary to find and fix them on future. |
09cd9c5c7c40
modify conclution
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
388 |
09cd9c5c7c40
modify conclution
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
389 |
09cd9c5c7c40
modify conclution
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
390 |