# HG changeset patch # User Nobuyasu Oshiro # Date 1339785715 -32400 # Node ID 39f6db695840af93b1a05a41da3db54e2e54aa6f # Parent c2207a9208a57393b9231fc9a4857d4c7d23f888 modify macro diff -r c2207a9208a5 -r 39f6db695840 paper/rectype.ind --- a/paper/rectype.ind Sat Jun 16 03:22:51 2012 +0900 +++ b/paper/rectype.ind Sat Jun 16 03:41:55 2012 +0900 @@ -13,8 +13,8 @@ The destination of goto statement is called Code Segment, which is actually a normal function of C. To represent recursive function call, the type system of C is not enough, because it has no recursive types. -We introduce \rectype keyword for recursive type, and it is implemented in GCC-4.6.0. -We will compare the conventional methods, \rectype keyword and a method using C structure. +We introduce \rectype{} keyword for recursive type, and it is implemented in GCC-4.6.0. +We will compare the conventional methods, \rectype{} keyword and a method using C structure. Also we show usage of CbC and it's benchmark. --Motivation @@ -32,11 +32,11 @@ and parameterized goto statement. C has capable of recursive functions, but we find it's type system is not enough -to represent CbC programming. In this paper, we introduce \rectype +to represent CbC programming. In this paper, we introduce \rectype{} keyword as a recursive type. To handle recursive type, conventionally tagged struct is used. It is also fit for CbC program. -We will describe the CbC and \rectype implementation of CbC on GCC 4.6.0. +We will describe the CbC and \rectype{} implementation of CbC on GCC 4.6.0. --Continuation based C @@ -122,8 +122,8 @@ Omitting types of the arguments of a function is allowed, but it requires complex declaration and it is incomplete. -We introduce \rectype syntax for this situation. In an argument deflation, -\rectype represents it's function type. Using \rectype, previous example can +We introduce \rectype{} syntax for this situation. In an argument deflation, +\rectype{} represents it's function type. Using \rectype{}, previous example can be written like this; __code csA( __rectype *p) { @@ -133,7 +133,7 @@ {\tt *p} has a type of {\tt csA} itself. The same situation is happen in conventional C, since Code Segment is a -mere C function with tail-call-elimination. \rectype provides exact and +mere C function with tail-call-elimination. \rectype{} provides exact and concise way to describe recursive type. If we have extra arguments, __code csBs(int a, __rectype *p) ; @@ -142,7 +142,7 @@ goto p(a, csBs); } -In this case, we have two \rectype keywords. It may points the same type or +In this case, we have two \rectype{} keywords. It may points the same type or different types. There is no ambiguity here, because it point the exact position. If it points the same position in the same type declaration, it is the same type. @@ -150,7 +150,7 @@ --Recursive type syntax in a function body -\rectype can be appeared in a function arguments, a function body or struct definition as a +\rectype{} can be appeared in a function arguments, a function body or struct definition as a pointer type, otherwise it errors. In a function body, it has a type of the function itself. @@ -170,7 +170,7 @@ but previous one is shorter. -We cannot allow non pointer type \rectype, because it generates infinite size of object. +We cannot allow non pointer type \rectype{}, because it generates infinite size of object. In case of struct, @@ -204,18 +204,18 @@ return 0; } -\rectype is clearer but struct technique provides abstract representation. It requires +\rectype{} is clearer but struct technique provides abstract representation. It requires extra struct declaration, but it give us the same assembler output. __code fibonacci(__rectype *p, int num, int count, int result, int prev) ---How to implement \rectype +--How to implement \rectype{} -\rectype syntax is implemented overriding AST. -First, \rectype syntax make Tree same \code(\ref{fig:tree1}). +\rectype{} syntax is implemented overriding AST. +First, \rectype{} syntax make Tree same \code(Fig.\ref{fig:tree1}). Second, tree was created to be rectype flag. -Third, to override AST(\ref{fig:tree2}). +Third, to override AST(Fig.\ref{fig:tree2}). \begin{figure}[htpb] \begin{minipage}{0.5\hsize} @@ -234,12 +234,12 @@ \end{minipage} \end{figure} -This AST(\ref{fig:tree2}) is made by syntax of \verb+__code csA(__rectype *p)+ . -\treelist have information of argument. -First \treelist represent that argument is function pointer(\verb+__code (*p)()+) . -Second \treelist represent that csA is Fixed-length argument. -Third \treelist is connected with \pointertype. -\pointertype have pointer of function(\functiontype). +This AST(Fig.\ref{fig:tree2}) is made by syntax of \verb+__code csA(__rectype *p)+ . +\treelist{} have information of argument. +First \treelist{} represent that argument is function pointer(\verb+__code (*p)()+) . +Second \treelist{} represent that csA is Fixed-length argument. +Third \treelist{} is connected with \pointertype. +\pointertype{} have pointer of function(\functiontype). We have to override it in the pointer of csA. @@ -261,7 +261,7 @@ csA's argument is p. GCC is also an infinite recursion happens to see the type of argument of the argument. -We Solve this problem that does not check the arguments if the \rectype flag is true. +We Solve this problem that does not check the arguments if the \rectype{} flag is true. The following program become part was fixed gcc/c-family/c-pretty-print.c. static void @@ -358,8 +358,8 @@ exit(0); } -It is written using \rectype syntax. -Do not use the \rectype syntax program would be the following declaration. +It is written using \rectype{} syntax. +Do not use the \rectype{} syntax program would be the following declaration. __code print(__code (*p)(__code(*)(),long int,long int,long int,long int), long int num, long int count, long int result, long int prev); @@ -380,10 +380,10 @@ We have designed and implemented Continuation based language for practical use. -We have implemented \rectype syntax in GCC for CbC. +We have implemented \rectype{} syntax in GCC for CbC. Thereby Easyly be able to write CbC program than previous. -This \rectype implementation may be other problems. +This \rectype{} implementation may be other problems. If so, it is necessary to find and fix them on future.