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

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/high-il/normalize.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/high-il/normalize.sml

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

revision 2520, Mon Dec 30 05:08:47 2013 UTC revision 2521, Thu Jan 9 02:17:07 2014 UTC
# Line 110  Line 110 
110    
111    
112    
113    fun check params _=1
114    
115  fun doRHS (lhs, IL.EINAPP (ein, args))=(let  fun doRHS (lhs, IL.EINAPP (ein, args))=(let
116      val x= print (String.concat[" ---Current: ", P.printerE(ein)])      val x= print (String.concat[" ---Current: ", P.printerE(ein)])
117    
# Line 122  Line 124 
124              end              end
125          | rewrite(change,orig, place, e::es,done)=let          | rewrite(change,orig, place, e::es,done)=let
126              val v =isEin e              val v =isEin e
127                val g=print(String.concat["\n checking argument First:", Int.toString(place)])
128              in case v              in case v
129    
130              of NONE=> (rewrite(change,orig, place+1, es, done@[e]))              of NONE=> (rewrite(change,orig, place+1, es, done@[e]))
131                  | SOME(IL.EINAPP (e2,arg1))=>let                  | SOME(IL.EINAPP (e2,arg1))=>let
132                    val Ein.EIN{params, index, body}=orig
133                    val g=print(String.concat["checking argument:", Int.toString(place), "number of params",Int.toString(length(params)),"\n"])
134                    val t=List.nth(params, place)
135                    in (case t
136                        of Ein.TEN 0=> (rewrite(change,orig, place+1, es, done@[e]))
137                        | _=> let
138                      val m= print(String.concat["\n Apply at ", Int.toString(place),":--",P.printerE(e2),                      val m= print(String.concat["\n Apply at ", Int.toString(place),":--",P.printerE(e2),
139                          "\n"])                          "\n"])
140                      val (c,subst)=App.app(orig,place,e2)                      val (c,subst)=App.app(orig,place,e2)
141                      val m= print(String.concat["\n","Subst Result:\t", P.printerE(subst), "\n"])                      val m= print(String.concat["\n","Subst Result:\t", P.printerE(subst), "\n"])
142                            in (case c of 0 => rewrite(1,subst, place+length(arg1), es,done@arg1)
143                      in (case c                              |_=> (incUse lhs;decUse e;rewrite(1,subst, place+length(arg1), es,done@arg1)))
144                          of 0 =>                          end
145                             rewrite(1,subst, place+length(arg1), es,done@arg1)                      (*end case*))
146                         |_=> (incUse lhs;decUse e;rewrite(1,subst, place+length(arg1), es,done@arg1))) end                  end
147              end              end
148    
149      val m= rewrite(0,ein, 0,args,[])      val m= rewrite(0,ein, 0,args,[])

Legend:
Removed from v.2520  
changed lines
  Added in v.2521

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