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

SCM Repository

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

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

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

revision 2406, Wed Jul 31 04:52:12 2013 UTC revision 2407, Wed Jul 31 04:52:25 2013 UTC
# Line 9  Line 9 
9       (* structure R = Rewrite*)       (* structure R = Rewrite*)
10      in      in
11    
12      fun intList l = String.concatWith "," (List.map Int.toString l)      fun intList l = String.concat[String.concatWith "," (List.map Int.toString l)]
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
16                   of E.Tensor(id, [])  => String.concat[" S",Int.toString(id)]                   of E.Tensor(id, [])  => String.concat[" S",Int.toString(id)]
17                    | E.Tensor(id, mx) =>  String.concat[" T",Int.toString(id), "_",intList(mx)]                    | E.Tensor(id, mx) =>  String.concat[" T",Int.toString(id),intList(mx)]
18                    | E.Const e => Real.toString(e)                    | E.Const e => Real.toString(e)
19                      | E.Field(id, []) => String.concat ["F",Int.toString(id)]
20                    | E.Field(id, mx) => String.concat ["F",Int.toString(id),"_",intList(mx)]                    | E.Field(id, mx) => String.concat ["F",Int.toString(id),"_",intList(mx)]
21                    | E.Add e        => String.concatWith "+" (List.map printer2 e)                    | E.Add e        => String.concatWith "+" (List.map printer2 e)
22                    | E.Sub(a,b)      => String.concat ["(",printer2(a),"- ",printer2(b), ")"]                    | E.Sub(a,b)      => String.concat ["(",printer2(a),"- ",printer2(b), ")"]
# Line 30  Line 31 
31                        in                        in
32                          String.concat [v,"*",k,"{",imp(deltas),"}_",Int.toString(n)]                          String.concat [v,"*",k,"{",imp(deltas),"}_",Int.toString(n)]
33                        end                        end
34                    | E.Partial e  => String.concat ["d",Int.toString(length(e)),"/dx_",intList(e)]                    | E.Partial e  => String.concat ["d^",Int.toString(length(e)),"/dx_",intList(e)]
35                    | E.Probe(a,b) => String.concat ["(",printer2(a), ")","@","T",Int.toString(b)]                    | E.Probe(a,b) => String.concat ["(",printer2(a), ")","@","T",Int.toString(b)]
36                    | E.Apply(a,b) => String.concat [ printer2(a)," ", printer2(b)," "]                    | E.Apply(a,b) => String.concat [ printer2(a)," ", printer2(b)," "]
37                    | E.Sum (id,a) => String.concat [" Sigma:", Int.toString(id), " ",printer2(a)]                    | E.Sum (id,a) => String.concat [" Sigma:", Int.toString(id), " ",printer2(a)]

Legend:
Removed from v.2406  
changed lines
  Added in v.2407

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