Mercurial > hg > Papers > 2012 > aplas
changeset 18:33b7a54edaa9
method other rectype
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 15 Jun 2012 03:55:36 +0900 |
parents | 02bd9a41010f |
children | dc62dc1fe059 |
files | paper/rectype.ind |
diffstat | 1 files changed, 18 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/paper/rectype.ind Fri Jun 15 02:50:28 2012 +0900 +++ b/paper/rectype.ind Fri Jun 15 03:55:36 2012 +0900 @@ -223,8 +223,8 @@ --How to implement \rectype \rectype syntx is implemented overriding AST. First, \rectype syntax make Tree same \code(\ref{fig:tree1}). -Second, Tree was created to be rectype flag. -Thrid, To override AST(\ref{fig:tree2}). +Second, tree was created to be rectype flag. +Thrid, to override AST(\ref{fig:tree2}). \begin{figure}[htpb] \begin{minipage}{0.5\hsize} @@ -252,28 +252,37 @@ We have to override it in the pointer of csA. +-- + + + + --Method other than \rectype +The recursively program of C's syntax can be solved using struct syntax. +For example, if we write + struct interface { __code (*next)(struct interface); }; __code csA(struct interface p) { - struct interface ds = { csB }; + struct interface ds; + ds.next = csB; goto p.next(ds); } int main() { - struct interface ds = { print }; + struct interface ds; + ds = print; goto csA(ds); return 0; } - - - - - __code fibonacci(__rectype *p, int num, int count, int result, int prev) { +there is no need to write recursively. +Because the struct syntax wrapped in a function pointer. +Code segment does not receive function pointer in arguments. +Recursively program does not occur.