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

SCM Repository

[diderot] Diff of /branches/charisee_dev/src/compiler/ein/printer.sml
ViewVC logotype

Diff of /branches/charisee_dev/src/compiler/ein/printer.sml

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

revision 2388, Sun Jun 16 17:02:02 2013 UTC revision 2391, Sun Jun 16 19:14:08 2013 UTC
# Line 7  Line 7 
7      structure E = Ein      structure E = Ein
8      structure S = Specialize      structure S = Specialize
9      structure R = Rewrite      structure R = Rewrite
   
10          in          in
11    
12        fun intList l = String.concatWith "," (List.map Int.toString l)
     fun intList([])=""  
         |intList(e::es)= Int.toString(e)^ intList(es)  
   
   
13    
14          fun printerE(Ein.EIN{params, index, body})= let          fun printerE(Ein.EIN{params, index, body})= let
15          fun printer2 term = (case term          fun printer2 term = (case term
# Line 35  Line 30 
30              | E.Sub(b,c)=>("("^printer2(b)^"- "^printer2(c)^ ")")              | E.Sub(b,c)=>("("^printer2(b)^"- "^printer2(c)^ ")")
31    
32              | E.Prod(e)=>let              | E.Prod(e)=>let
33                  fun imp([])=""                        fun imp [] = ""
34                  | imp([a])=printer2(a)                          | imp [a] = printer2(a)
35                  | imp(a::es)=printer2(a)^" "^imp(es)                  | imp(a::es)=printer2(a)^" "^imp(es)
36                  in "("^imp(e)^")" end                  in "("^imp(e)^")" end
37              | E.Delta(i,j)=> (" Delta_"^Int.toString(i)^Int.toString(j))              | E.Delta(i,j)=> (" Delta_"^Int.toString(i)^Int.toString(j))
# Line 52  Line 47 
47              | E.Sum (id,a)=> ( " Sigma:"^Int.toString(id)^ printer2(a) )              | E.Sum (id,a)=> ( " Sigma:"^Int.toString(id)^ printer2(a) )
48              |_=>("newbie")              |_=>("newbie")
49              (*end case *))              (*end case *))
50              fun Index ((E.IX(dim))::i, count)=("("^Int.toString(count)^            fun Index ((E.IX(dim))::i, count) = String.concat[
51                      " DIM:"^Int.toString(dim)^")"^ Index(i,count+1))                    "(", Int.toString count, " DIM:", Int.toString dim, ")",
52                      Index(i,count+1)
53                    ]
54                  |Index ((E.SX(dim))::i, count)=("} {Summation:("^Int.toString(count) ^                  |Index ((E.SX(dim))::i, count)=("} {Summation:("^Int.toString(count) ^
55                      " DIM:"^Int.toString(dim)^")"^ Index(i,count+1))                      " DIM:"^Int.toString(dim)^")"^ Index(i,count+1))
56                  | Index(_, count)= ("")              | Index (_, count) = ""
57              in              in
58                  ("\n<"^printer2(body)^">"^"_{"^Index(index,0)^"}")                  ("\n<"^printer2(body)^">"^"_{"^Index(index,0)^"}")
59              end              end
# Line 70  Line 67 
67          |printerApp(_)=""          |printerApp(_)=""
68    
69    
70  end      end (* local *)
71  end  end

Legend:
Removed from v.2388  
changed lines
  Added in v.2391

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