Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/high-to-mid/ProbeEin.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/high-to-mid/ProbeEin.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2827, Tue Nov 11 00:18:38 2014 UTC revision 2847, Mon Dec 15 02:17:32 2014 UTC
# Line 1  Line 1 
1  (* Currently under construction  (* Expands probe ein
2   *   *
3   * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)   * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4   * All rights reserved.   * All rights reserved.
5   *)   *)
6    
   
 (*  
 A couple of different approaches.  
 One approach is to find all the Probe(Conv). Gerenerate exp for it  
 Then use Subst function to sub in. That takes care for index matching and  
   
 *)  
   
 (*This approach creates probe expanded terms, and adds params to the end. *)  
   
   
7  structure ProbeEin = struct  structure ProbeEin = struct
8    
9      local      local
10    
11      structure E = Ein      structure E = Ein
     structure mk= mkOperators  
     structure SrcIL = HighIL  
     structure SrcTy = HighILTypes  
     structure SrcOp = HighOps  
     structure SrcSV = SrcIL.StateVar  
     structure VTbl = SrcIL.Var.Tbl  
12      structure DstIL = MidIL      structure DstIL = MidIL
     structure DstTy = MidILTypes  
13      structure DstOp = MidOps      structure DstOp = MidOps
     structure DstV = DstIL.Var  
     structure SrcV = SrcIL.Var  
14      structure P=Printer      structure P=Printer
     structure shift=ShiftEin  
     structure split=SplitEin  
     structure F=Filter  
15      structure T=TransformEin      structure T=TransformEin
16        structure MidToS=MidToString
     val testing=0  
   
   
17      in      in
18    
19    (* This file expands probed fields
20    * Take a look at ProbeEin tex file for examples
21    *Note that the original field is an EIN operator in the form <V_alpha * H^(deltas)>(midIL.var list )
22    * Param_ids are used to note the placement of the argument in the midIL.var list
23    * Index_ids  keep track of the shape of an Image or differentiation.
24    * Mu  bind Index_id
25    * Generally, we will refer to the following
26    *dim:dimension of field V
27    * s: support of kernel H
28    * alpha: The alpha in <V_alpha * H^(deltas)>
29    * deltas: The deltas in <V_alpha * H^(deltas)>
30    * Vid:param_id for V
31    * hid:param_id for H
32    * nid: integer position param_id
33    * fid :fractional position param_id
34    *img-imginfo about V
35    *)
36    
37  fun assign (x, rator, args) = (x, DstIL.OP(rator, args))      val testing=0
38  fun assignEin (x, rator, args) = ((x, DstIL.EINAPP(rator, args)))      val cnt = ref 0
   
39    
40  (*Create fractional, and integer position vectors*)      fun transformToIndexSpace e=T.transformToIndexSpace e
41  fun transformToImgSpace  (dim,v,posx,imgArgDst)=let      fun transformToImgSpace  e=T.transformToImgSpace  e
42      val translate=DstOp.Translate v      fun testp n=(case testing
43      val transform=DstOp.Transform v          of 0=> 1
44      val M  = DstV.new ("M", DstTy.tensorTy [dim,dim])   (*transform dim by dim?*)          | _ =>(print(String.concat n);1)
     val T  = DstV.new ("T", DstTy.tensorTy [dim])   (*translate*)  
     val x  = DstV.new ("x", DstTy.vecTy dim)            (*Image-Space position*)  
     val f  = DstV.new ("f", DstTy.vecTy dim)            (*fractional*)  
     val nd = DstV.new ("nd", DstTy.vecTy dim)           (*real position*)  
     val n  = DstV.new ("n", DstTy.iVecTy dim)           (*integer position*)  
     val PosToImgSpace=mk.transform(dim,dim)  
     val P  = DstV.new ("P", DstTy.tensorTy [dim,dim])   (*transform dim by dim?*)  
     val code=[  
         assign(M, transform, [imgArgDst]),  
         assign(T, translate, [imgArgDst]),  
         assignEin(x, PosToImgSpace,[M,posx,T]) ,  (* MX+T*)  
         assign(nd, DstOp.Floor dim, [x]),   (*nd *)  
         assignEin(f, mk.subTen([dim]),[x,nd]),           (*fractional*)  
         assign(n, DstOp.RealToInt dim, [nd]), (*real to Int*)  
         assignEin(P, mk.transpose([dim,dim]), [M])  
         ]  
     in ([n,f],P,code)  
     end  
   
 fun getRHS x  = (case SrcIL.Var.binding x  
     of SrcIL.VB_RHS(SrcIL.OP(rator, args)) => (rator, args)  
     | SrcIL.VB_RHS(SrcIL.VAR x') => getRHS x'  
     | vb => raise Fail(concat[ "expected rhs operator for ", SrcIL.Var.toString x, "but found ", SrcIL.vbToString vb])  
45      (* end case *))      (* end case *))
46        fun getRHSDst x  = (case DstIL.Var.binding x
47  (*Get Img, and Kern Args*)          of DstIL.VB_RHS(DstIL.OP(rator, args)) => (rator, args)
48  fun getArgs(hid,hArg,V,imgArg,args,lift,varI)=(case (getRHS hArg,getRHS imgArg)          | DstIL.VB_RHS(DstIL.VAR x') => getRHSDst x'
49      of ((SrcOp.Kernel(h, i), _ ),(SrcOp.LoadImage img, _ ))=> let          | vb => raise Fail(concat[ "expected rhs operator for ", DstIL.Var.toString x, "but found ", DstIL.vbToString vb])
         val hvar=DstV.new ("KNL", DstTy.KernelTy)  
         val imgvar=DstV.new ("IMG", DstTy.ImageTy img)  
         val argsVK= (case lift  
             of 0=> let  
                 val _=print "non lift"  
                 val l1=List.take(args, hid)  
                 val l2=List.drop(args,hid+1)  
                 in  
                     l1@[hvar]@l2  
                 end  
             | _ => [varI, hvar]  
50          (* end case *))          (* end case *))
51    
52          val assigments=[assign (hvar, DstOp.Kernel(h, i), [])]  
53        (* getArgsDst:MidIL.Var* MidIL.Var->int, ImageInfo, int
54            uses the Param_ids for the image, kernel,
55            and position tensor to get the Mid-IL arguments
56        returns the support of ther kernel, and image
57        *)
58        fun getArgsDst(hArg,imgArg,args)=(case (getRHSDst hArg,getRHSDst imgArg)
59            of ((DstOp.Kernel(h, i), _ ),(DstOp.LoadImage img, _ ))=> let
60          in          in
61              ((Kernel.support h) ,img, assigments,argsVK)                  ((Kernel.support h) ,img,ImageInfo.dim img)
62          end          end
63      |  _ => raise Fail "Expected Image and kernel argument"          |  _ => raise Fail "Expected Image and kernel arguments"
64      (*end case*))      (*end case*))
65    
66    
67  fun handleArgs(V,h,t,(params,args),origargs,lift,dstargs)=let      (*handleArgs():int*int*int*Mid IL.Var list
68      val E.IMG(dim)=List.nth(params,V)          ->int*Mid.ILVars list* code*int* low-il-var
69      val kArg=List.nth(origargs,h)          * uses the Param_ids for the image, kernel, and tensor
70      val imgArg=List.nth(origargs,V)          * and gets the mid-IL vars for each.
71      val newposArg=List.nth(args, t)          *Transforms the position to index space
72      val imgArgDst=List.nth(dstargs,V)          *P is the mid-il var for the (transformation matrix)transpose
73      val (s,img,argcode,argsVH) =getArgs(h,kArg,V,imgArg,args,lift,imgArgDst)      *)
74      val (argsT,P,code')=transformToImgSpace(dim,img,newposArg,imgArgDst)      fun handleArgs(Vid,hid,tid,args)=let
75      in (dim,argsVH@argsT,argcode@code', s,P)          val imgArg=List.nth(args,Vid)
76            val hArg=List.nth(args,hid)
77            val newposArg=List.nth(args,tid)
78            val (s,img,dim) =getArgsDst(hArg,imgArg,args)
79            val (argsT,P,code)=transformToImgSpace(dim,img,newposArg,imgArg)
80            in
81                (dim,args@argsT,code, s,P)
82      end      end
83    
84        (*createBody:int*int*int,mu list, param_id, param_id, param_id, param_id
85  (*createDels=> creates the kronecker deltas for each Kernel*)      * expands the body for the probed field
86  fun createDels([],_)= []      *)
87      | createDels(d::ds,dim)= [( E.C dim,d)]@createDels(ds,dim)      fun createBody(dim, s,sx,alpha,deltas,Vid, hid, nid, fid)=let
88            (*1-d fields*)
89  (*Created new body for probe*)          fun createKRND1 ()=let
90  fun createBody(dim, s,sx,shape,deltas,V, h, nid, fid)=let              val sum=sx
91                val dels=List.map (fn e=>(E.C 0,e)) deltas
92      (*sumIndex creating summaiton Index for body*)              val pos=[E.Add[E.Tensor(fid,[]),E.Value(sum)]]
93      fun sumIndex(0)=[]              val rest= E.Krn(hid,dels,E.Sub(E.Tensor(nid,[]),E.Value(sum)))
94      |sumIndex(dim)= sumIndex(dim-1)@[(E.V (dim+sx-1),1-s,s)]              in
95                    E.Prod [E.Img(Vid,alpha,pos),rest]
96                end
97      (*createKRN Image field and kernels *)      (*createKRN Image field and kernels *)
98      fun createKRN(0,imgpos,rest)=E.Prod ([E.Img(V,shape,imgpos)] @rest)          fun createKRN(0,imgpos,rest)=E.Prod ([E.Img(Vid,alpha,imgpos)] @rest)
99      | createKRN(dim,imgpos,rest)=let      | createKRN(dim,imgpos,rest)=let
100          val dim'=dim-1          val dim'=dim-1
101          val sum=sx+dim'          val sum=sx+dim'
102          val dels=createDels(deltas,dim')              val dels=List.map (fn e=>(E.C dim',e)) deltas
103          val pos=[E.Add[E.Tensor(fid,[E.C dim']),E.Value(sum)]]          val pos=[E.Add[E.Tensor(fid,[E.C dim']),E.Value(sum)]]
104          val rest'= E.Krn(h,dels,E.Sub(E.Tensor(nid,[E.C dim']),E.Value(sum)))              val rest'= E.Krn(hid,dels,E.Sub(E.Tensor(nid,[E.C dim']),E.Value(sum)))
105          in          in
106              createKRN(dim',pos@imgpos,[rest']@rest)              createKRN(dim',pos@imgpos,[rest']@rest)
107          end          end
108            val exp=(case dim
109      val exp=createKRN(dim, [],[])              of 1 => createKRND1()
110      val esum=sumIndex (dim)              | _=> createKRN(dim, [],[])
111      in E.Sum(esum, exp)              (*end case*))
112      end          (*sumIndex creating summaiton Index for body*)
113            val slb=1-s
114            val esum=List.tabulate(dim, (fn dim=>(E.V (dim+sx),slb,s)))
 fun ShapeConv([],n)=[]  
     | ShapeConv(E.C c::es, n)=ShapeConv(es, n)  
     | ShapeConv(E.V v::es, n)=  
         if(n>v) then [E.V v] @ ShapeConv(es, n)  
         else ShapeConv(es,n)  
   
   
 fun mapIndex([],_)=[]  
     | mapIndex(E.V v::es,index) = [List.nth(index, v)]@ mapIndex(es,index)  
     | mapIndex(E.C c::es,index) = mapIndex(es,index)  
   
   
 (*  
 (*Lift probe and Multiply by P*)  
 fun liftProbe(E.Probe(E.Conv(V,alpha,H,dx),E.Tensor(t,_)),(params,args),index, sumIndex,origargs)=let  
     val _ =print "Lift Probe"  
   
     val n=length(index)  
     val ns=length sumIndex  
     val nshift=length(dx)  
     val np=length(params)  
     val nsumshift =(case ns  
         of 0=>   n  
         |_=>let  val (E.V v,_,_)=List.nth(sumIndex, ns-1)  
115              in              in
116                  v+1          E.Sum(esum, exp)
117              end              end
         (* end case *))  
   
118    
119      (*Outer Index-id Of Probe*)      (*getsumshift:sum_indexid list* int list-> int
120      val VShape=ShapeConv(alpha, n)      *get fresh/unused index_id, returns int
121      val HShape=ShapeConv(dx, n)      *)
122      val shape=VShape@HShape      fun getsumshift(sx,index) =let
123            val nsumshift= (case sx
124      (* Bindings for Shape*)              of []=> length(index)
125      val shapebind= mapIndex(shape,index)              | _=>let
126      val Vshapebind= mapIndex(VShape,index)                  val (E.V v,_,_)=List.hd(List.rev sx)
127                    in v+1
128      (*Look at Args and get dim, mid-il ops, support, and Arg for transformation matrix P*)                  end
     val (dim,args',code,support,PArg) = handleArgs(V,H,t,(params,args), origargs,1)  
     val _ =print("\nSupport is "^Int.toString support)  
   
     (*New transformations:params, sx, rest, will be empty if no transformation is made*)  
     val (oldArg,newArg,dx, paramsT,sxT,restT,ixT,dataT) = T.Transform(dx,shapebind,Vshapebind,dim,PArg,nsumshift,ns,4)  
   
     (*rewriteBody*)  
     val bodyExpanded = createBody(dim, support,nsumshift+nshift,alpha,dx,0, 1, 3, 2)  
   
     val sx=sumIndex@sxT  
     val body'=(case sx  
         of [] =>E.Prod(restT@[bodyExpanded])  
         | _ => E.Sum(sx, E.Prod(restT@[bodyExpanded]))  
         (*end case*))  
   
     (*create new EIN OPerator*)  
     val _ =print("Found this many args ")  
     val _ =print(Int.toString(length(args')))  
   
     val params'=[E.IMG(dim),E.KRN,E.TEN(3,[dim]),E.TEN(1,[dim])]@paramsT  
     val (p',i',b',a')=shift.clean(params', index@ixT, body', args'@[PArg])  
     val newbie'=Ein.EIN{params=p', index=i', body=b'}  
     val data=assignEin (oldArg, newbie', a')  
   
     val _ = (case testing  
         of 0 => 1  
         | _ => (print(String.concat["\n Lift Probe\n", split.printA(newArg, newbie', a'),"\n"]);1)  
129          (*end case *))          (*end case *))
130            val aa=List.map (fn (E.V v,_,_)=>Int.toString v) sx
131            val _ =testp["\n", "SumIndex" ,(String.concatWith"," aa),
132                "\nThink nshift is ", Int.toString nsumshift]
133      in      in
134          (E.Tensor(np,shape), (params@[E.TEN(1,shapebind)],args@[newArg]),code@[data]@dataT)              nsumshift
135      end      end
  |liftProbe _ =raise Fail"Incorrect body for Probe"  
136    
137        (*formBody:ein_exp->ein_exp
138        *just does a quick rewrite
139  *)  *)
140        fun formBody(E.Sum([],e))=formBody e
141        | formBody(E.Sum(sx,e))= E.Sum(sx,formBody e)
142        | formBody(E.Prod [e])=e
143  (*Does not yet do transformation*)      | formBody e=e
144   (* Expand probe in place *)  
145   fun replaceProbe(b,(params,args),index, sumIndex,origargs,dstargs)=let      (* replaceProbe:ein_exp* params *midIL.var list * int list* sum_id list
146                -> ein_exp* *code
147      val E.Probe(E.Conv(V,alpha,h,dx),E.Tensor(t,_))=b      * Transforms position to world space
148        * transforms result back to index_space
149        * rewrites body
150        * replace probe with expanded version
151        *)
152        fun replaceProbe(b,params,args,index, sx)=let
153            val E.Probe(E.Conv(Vid,alpha,hid,dx),E.Tensor(tid,_))=b
154      val fid=length(params)      val fid=length(params)
155      val nid=fid+1      val nid=fid+1
156      val n=length(index)          val Pid=nid+1
     val ns=length sumIndex  
157      val nshift=length(dx)      val nshift=length(dx)
158      val nsumshift =(case ns          val (dim,argsA,code,s,PArg) = handleArgs(Vid,hid,tid,args)
159          of 0=> n          val freshIndex=getsumshift(sx,index)
160          | _=>let          val (dx,newsx1,Ps)=transformToIndexSpace(freshIndex,dim,dx,Pid)
             val (E.V v,_,_)=List.nth(sumIndex, ns-1)  
             in v+1  
             end  
     (* end case *))  
   
     (*Outer Index-id Of Probe*)  
     val VShape=ShapeConv(alpha, n)  
     val HShape=ShapeConv(dx, n)  
     val shape=VShape@HShape  
     (* Bindings for Shape*)  
     val shapebind= mapIndex(shape,index)  
     val Vshapebind= mapIndex(VShape,index)  
   
   
     val (dim,argsA,code,s,PArg) = handleArgs(V,h,t,(params,args), origargs,0,dstargs)  
     val _ =print("\nSupport is "^Int.toString s)  
     val (_,_,dx, _,sxT,restT,_,_) = T.Transform(dx,shapebind,Vshapebind,dim,PArg,nsumshift,1,nid+1)  
   
161      val params'=params@[E.TEN(3,[dim]),E.TEN(1,[dim]),E.TEN(1,[dim,dim])]      val params'=params@[E.TEN(3,[dim]),E.TEN(1,[dim]),E.TEN(1,[dim,dim])]
162      val body'' = createBody(dim, s,nsumshift+nshift,alpha,dx,V, h, nid, fid)          val body' = createBody(dim, s,freshIndex+nshift,alpha,dx,Vid, hid, nid, fid)
163      val body' =(case nshift          val body' =formBody(E.Sum(newsx1, E.Prod(Ps@[body'])))
         of 0=> body''  
         | _ => E.Sum(sxT, E.Prod(restT@[body'']))  
         (*end case*))  
164      val args'=argsA@[PArg]      val args'=argsA@[PArg]
     val _ =(case testing  
         of 0=> 1  
         | _ =>  let  
             val subexp=Ein.EIN{params=params', index=index, body=body'}  
             val _= print(String.concat["\n Don't replace probe  \n $$$ new sub-expression $$$ \n",P.printerE(subexp),"\n"])  
             in 1 end  
         (* end case *))  
   
   
     in (body',(params',args') ,code)  
     end  
   
 (*  
 (*Checks if (1) Summation variable occurs just once (2) it matches n.  
 Then we lift otherwise expand in place *)  
 fun checkSum(sx,b,info,index,origargs)=(case sx  
     of [(E.V i,lb,ub)]=>  let  
         val E.Probe(E.Conv(V,alpha,h,dx), E.Tensor(id,beta))=b  
         val n=length(index)  
         val _=(case testing  
             of 1=> (print(String.concat["in check Sum\n " ,P.printbody(E.Sum([(E.V i,lb,ub)],b))]);1)  
             |_ => 1)  
         in  
             if (i=n) then (case F.countSx(sx,b)  
                 of (1,ixx) => liftProbe(b,info,index@[ub], [],origargs)  
                 | _ => replaceProbe(b, info,index,sx,origargs)  
                 (*end case*))  
             else replaceProbe(b, info,index, sx,origargs)  
         end  
     | _ =>replaceProbe(b, info,index, sx,origargs)  
     (*end case*))  
 *)  
   
 fun flatten []=[]  
     | flatten(e1::es)=e1@(flatten es)  
   
   
  (* sx-[] then move out, otherwise keep in *)  
 fun expandEinOp ( Ein.EIN{params, index, body}, origargs,args) = let  
   
     val dummy=E.Const 0  
     val sumIndex=ref []  
   
     (*b-current body, info-original ein op, data-new assigments*)  
     fun rewriteBody(b,info)= let  
   
         fun callfn(c1,body)=let  
             val ref x=sumIndex  
             val c'=[c1]@x  
             val (bodyK,infoK,dataK)= (sumIndex:=c';rewriteBody(body ,info))  
             val ref s=sumIndex  
             val z=hd(s)  
             val e'=( case bodyK  
                 of E.Const _ =>bodyK  
                 | _ => E.Sum(z,bodyK)  
                 (*end case*))  
165              in              in
166                  (sumIndex:=tl(s);(e',infoK,dataK))              (body',params',args' ,code)
167              end              end
168    
169        (* expandEinOp: code->  code list
170          (*Nothing liftProbe and checkSum are commented out.      *Looks to see if the expression has a probe. If so, replaces it.
171              Some mistake underestimating size of dimension*)      * Note how we keeps eps expressions so only generate pieces that are used
172        *)
173          fun filter es=let      fun expandEinOp( e as (y, DstIL.EINAPP(Ein.EIN{params, index, body}, args))) = let
174              fun filterApply([], doneB, infoB, dataB)= (doneB, infoB,dataB)          fun printResult code=testp["\nINSIDE PROBEEIN","\nbody",
175              | filterApply(B::es, doneA, infoA,dataA)= let                  MidToS.printEINAPP e, "\n=>\n",
176                  val (bodyB, infoB,dataB)= rewriteBody(B,infoA)                  (String.concatWith",\t"(List.map MidToS.printEINAPP code))]
177            fun rewriteBody b=(case b
178                of E.Probe(E.Field _,_)=> raise Fail"Poorly formed EIN operator. Argument needs to be applied in High-IL"
179                | E.Probe e =>let
180                    val (body',params',args',newbies)=replaceProbe(E.Probe e,params,args, index, [])
181                    val einapp=(y,DstIL.EINAPP(Ein.EIN{params=params', index=index, body=body'},args'))
182                    val code=newbies@[einapp]
183                    in
184                        code
185                    end
186                | E.Sum(sx,E.Probe e)  =>let
187                    val (body',params',args',newbies)=replaceProbe(E.Probe e,params,args, index, sx)
188                    val  body'=E.Sum(sx,body')
189                    val einapp=(y,DstIL.EINAPP(Ein.EIN{params=params', index=index, body=body'},args'))
190                    val code=newbies@[einapp]
191                    in
192                        code
193                    end
194                | E.Sum(sx,E.Prod[eps,E.Probe e]) =>let
195                    val (body',params',args',newbies)=replaceProbe(E.Probe e,params,args, index, sx)
196                    val  body'=E.Sum(sx,E.Prod[eps,body'])
197                    val einapp=(y,DstIL.EINAPP(Ein.EIN{params=params', index=index, body=body'},args'))
198                    val code=newbies@[einapp]
199                  in                  in
200                      filterApply(es, doneA@[bodyB], infoB,dataA@dataB)                      code
                 end  
             in filterApply(es, [],info,[])  
201              end              end
202          in (case b              | _=> [e]
             of  E.Sum(c,  E.Probe(E.Conv v, E.Tensor t)) =>let  
                 val ref sx=sumIndex  
                 in (case sx  
                     of  (* [] => liftProbe(E.Probe(E.Conv v, E.Tensor t ), info,index, c,origargs)  
                       | [i]=> checkSum(i,b, info,index,origargs)  
                       |*) _ => let  
                         val (b,m,code)=replaceProbe(E.Probe(E.Conv v, E.Tensor t ), info,index, (flatten sx)@c,origargs,args)  
                         in (E.Sum(c,b),m,code)  
                         end  
                 (* end case*))  
             end  
         | E.Probe(E.Conv _, E.Tensor _) =>let  
             val ref sx=sumIndex  
             in (case sx  
                 of (* []=> liftProbe(b, info,index, [],origargs)  
                 | [i]=> checkSum(i,b, info,index,origargs)  
                 |*) _ => replaceProbe(b, info,index, flatten sx,origargs,args)  
              (* end case*))  
             end  
         | E.Probe _=> (dummy,info,[])  
         | E.Conv _=>  (dummy,info,[])  
         | E.Lift _=> (dummy,info,[])  
         | E.Field _ => (dummy,info,[])  
         | E.Apply _ => (dummy,info,[])  
         | E.Neg e=> let  
             val (body',info',data')=rewriteBody(e,info)  
             in  
                 (E.Neg(body'),info',data')  
             end  
         | E.Sum (c,e)=> callfn(c,e)  
         | E.Sub(a,b)=>let  
             val (bodyA,infoA,dataA)= rewriteBody(a,info)  
             val (bodyB, infoB, dataB)= rewriteBody(b,infoA)  
             in   (E.Sub(bodyA, bodyB),infoB,dataA@dataB)  
             end  
         | E.Div(a,b)=>let  
             val (bodyA,infoA,dataA)= rewriteBody(a,info)  
             val (bodyB, infoB,dataB)= rewriteBody(b,infoA)  
             in  (E.Div(bodyA, bodyB),infoB,dataA@dataB) end  
         | E.Add es=> let  
             val (done, info',data')= filter es  
             val (_, e)=F.mkAdd done  
             in (e, info',data')  
             end  
         | E.Prod es=> let  
             val (done, info',data')= filter es  
             val (_, e)=F.mkProd done  
             in (e, info',data')  
             end  
         | _=>  (b,info,[])  
203          (* end case *))          (* end case *))
         end  
   
      val empty =fn key =>NONE  
      val _ =(case testing  
         of 0 => 1  
         | _ => (print "\n ************************** \n Starting Expand";1)  
         (*end case*))  
   
     val (body',(params',args'),newbies)=rewriteBody(body,(params,args))  
     val e'=Ein.EIN{params=params', index=index, body=body'}  
     (*val _ =(case testing  
         of 0 => 1  
         | _ => (String.concat[P.printerE(e'),"\n DONE expand ************************** \n "];1)  
         (*end case*))*)  
204      in      in
205          ((e',args'),newbies)              rewriteBody body
206      end      end
207    
208    end; (* local *)    end; (* local *)

Legend:
Removed from v.2827  
changed lines
  Added in v.2847

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0