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 3269, Fri Oct 9 00:54:03 2015 UTC revision 3271, Fri Oct 9 18:12:58 2015 UTC
# Line 31  Line 31 
31          | E.Value(ix)=> String.concat["_",iTos(ix),"_"]          | E.Value(ix)=> String.concat["_",iTos(ix),"_"]
32          | E.Epsilon(ix, jx, kx) => String.concat["ϵ_",iTos(ix), iTos(jx), iTos(kx)]          | E.Epsilon(ix, jx, kx) => String.concat["ϵ_",iTos(ix), iTos(jx), iTos(kx)]
33          | E.Eps2(ix, jx) => String.concat["ϵ_",iTos(ix), iTos(jx)]          | E.Eps2(ix, jx) => String.concat["ϵ_",iTos(ix), iTos(jx)]
34     | E.Sum ([(v,_,_)],e1)=>String.concat[" Σ_",handleIndex v,"⋐","⋑",handleIndex v]
35     | E.Sum (sumindex,e1)=>String.concat[" Σ_",(* String.concatWith ","(List.map handleSumRange sumindex),*)"⋐" ,"⋑"]
36     | E.Neg e1 => String.concat["-NEG-"]
37     | E.Lift e1 => String.concat["LIFT ⊢","⊣"]
38     | E.Add el => String.concat["(+",")"]
39     | E.Sub(e1, e2) => String.concat ["---- "]
40     | E.Prod el => String.concat["(","*)"]
41     | E.Div(e1,e2) => String.concat ["(",")/( ",")"]
42     | E.Partial alpha => String.concat["d/dx_",handleAlpha alpha]
43     | E.Apply(e1, e2)=> String.concat [ "@{","} "]
44     | E.Conv(fid,alpha, tid ,[])=> String.concat["|v",iTos(fid),"_{",handleAlpha alpha, "}★h(",iTos(tid),")|"]
45     | E.Conv(fid,alpha, tid, [b0,b1])=> String.concat["|v",iTos(fid),"_{",handleAlpha alpha, "}★h2(",iTos(tid),")dx_",handleAlpha [b0,b1],"}|"]
46     | E.Conv(fid,alpha, tid, beta)=> String.concat["|v",iTos(fid),"_{",handleAlpha alpha, "}★h(",iTos(tid),")dx_",handleAlpha beta,"}|"]
47     | E.Probe (e1,e2)=> String.concat ["[", "","@[","]]"]
48     | E.Img (fid,alpha,pos)=> String.concat [" V", iTos(fid),"_",handleAlpha alpha,"["(*,
49     (String.concatWith "," (List.map printbody pos)),"]"*)]
50     | E.Sqrt e => String.concat[ "√(",")"]
51     | E.PowInt(e,n1) => String.concat[  "(",")^",iTos n1]
52     | E.PowReal(e,n1) => String.concat[ "(", ")^",RationalEin.toString n1]
53     | E.Cosine e=>  String.concat["Cosine(",")"]
54     | E.ArcCosine e=> String.concat["ArcCosine(",")"]
55     | E.Sine e => String.concat["Sine(" ,")"]
56     | E.ArcSine e =>String.concat["ArcSine(" ,")"]
57     (* end case *))
58    
59     (*
60        fun printbody term = (case term
61            of E.Const r => iTos(r)
62            | E.ConstR r =>RationalEin.toString r
63            | E.Tensor(id, []) =>String.concat[" S",iTos(id)]
64            | E.Tensor(id, alpha) =>String.concat[" T",iTos(id),"_",handleAlpha alpha]
65            | E.Field(id, []) =>String.concat[" F",iTos(id)]
66            | E.Field(id, alpha) =>String.concat[" F",iTos(id),"_",handleAlpha alpha]
67            | E.Krn(tid,[],pos) =>String.concat[" H ",iTos(tid),"[",  (printbody pos),"]"]
68            | E.Krn(tid,betas,pos) => String.concat[" H",iTos(tid),"^{", String.concat (List.map handleBeta betas)(*,"} [",(printbody pos),"]"*)]
69            | E.Delta(ix) =>  handleBeta ix
70            | E.Value(ix)=> String.concat["_",iTos(ix),"_"]
71            | E.Epsilon(ix, jx, kx) => String.concat["ϵ_",iTos(ix), iTos(jx), iTos(kx)]
72            | E.Eps2(ix, jx) => String.concat["ϵ_",iTos(ix), iTos(jx)]
73          | E.Sum ([(v,_,_)],e1)=>String.concat[" Σ_",handleIndex v,"⋐" ,printbody e1,"⋑",handleIndex v]          | E.Sum ([(v,_,_)],e1)=>String.concat[" Σ_",handleIndex v,"⋐" ,printbody e1,"⋑",handleIndex v]
74          | E.Sum (sumindex,e1)=>String.concat[" Σ_",(* String.concatWith ","(List.map handleSumRange sumindex),*)"⋐" ,printbody e1,"⋑"]          | E.Sum (sumindex,e1)=>String.concat[" Σ_",(* String.concatWith ","(List.map handleSumRange sumindex),*)"⋐" ,printbody e1,"⋑"]
75          | E.Neg e1 => String.concat["-NEG-", printbody e1]          | E.Neg e1 => String.concat["-NEG-", printbody e1]
# Line 55  Line 94 
94          | E.Sine e => String.concat["Sine(",printbody e ,")"]          | E.Sine e => String.concat["Sine(",printbody e ,")"]
95          | E.ArcSine e => String.concat["ArcSine(",printbody e ,")"]          | E.ArcSine e => String.concat["ArcSine(",printbody e ,")"]
96          (* end case *))          (* end case *))
97    *)
98      (*printerE:EIN ->string*)      (*printerE:EIN ->string*)
99      fun printerE (Ein.EIN{params, index, body}) = let      fun printerE (Ein.EIN{params, index, body}) = let
100          fun Index (dim::i, count) = String.concat["(", iTos count,          fun Index (dim::i, count) = String.concat["(", iTos count,
# Line 70  Line 109 
109              | Param(_,_)=""              | Param(_,_)=""
110    
111          in          in
112              String.concat["-EIN-" ,Param(params, 0)," <",printbody(body),">"," _{",Index(index,0),"} "]             (* String.concat["-EIN-" ,Param(params, 0)," <",printbody(body),">"," _{",Index(index,0),"} "]*)
113                    printbody body
114          end          end
115    
116      end (* local *)      end (* local *)

Legend:
Removed from v.3269  
changed lines
  Added in v.3271

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