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 3276, Tue Oct 13 02:42:05 2015 UTC revision 3440, Mon Nov 16 19:16:54 2015 UTC
# Line 16  Line 16 
16      fun handleAlpha alpha= String.concat[String.concatWith "," (List.map handleIndex alpha)]      fun handleAlpha alpha= String.concat[String.concatWith "," (List.map handleIndex alpha)]
17      fun handleBeta(a,b)=String.concat["δ_(",handleIndex a, ",", handleIndex b,")"]      fun handleBeta(a,b)=String.concat["δ_(",handleIndex a, ",", handleIndex b,")"]
18      fun handleSumRange (mu,lb,ub)= String.concat[(handleIndex mu),"[",iTos(lb),"-",iTos(ub),"]"]      fun handleSumRange (mu,lb,ub)= String.concat[(handleIndex mu),"[",iTos(lb),"-",iTos(ub),"]"]
19        fun printbody b= (case b
   
     fun printbody term = (case term  
20          of E.Const r => iTos(r)          of E.Const r => iTos(r)
21          | E.ConstR r =>RationalEin.toString r          | E.ConstR r =>RationalEin.toString r
22          | E.Tensor(id, []) =>String.concat[" S",iTos(id)]          | E.Tensor(id, []) =>String.concat[" S",iTos(id)]
23          | E.Tensor(id, alpha) =>String.concat[" T",iTos(id),"_",handleAlpha alpha]          | E.Tensor(id, alpha) =>String.concat[" T",iTos(id),"_",handleAlpha alpha]
24          | E.Field(id, []) =>String.concat[" F",iTos(id)]          | E.Field(id, []) =>String.concat[" F",iTos(id)]
25          | E.Field(id, alpha) =>String.concat[" F",iTos(id),"_",handleAlpha alpha]          | E.Field(id, alpha) =>String.concat[" F",iTos(id),"_",handleAlpha alpha]
26          | E.Krn(tid,[],pos) =>String.concat[" H ",iTos(tid)(*,"[",  (printbody pos),"]"*)]          | E.Krn(tid,[],pos) =>String.concat[" H ",iTos(tid),"[",  (printbody pos),"]"]
27          | E.Krn(tid,betas,pos) => String.concat[" H",iTos(tid),"^{", String.concat (List.map handleBeta betas)(*,"} [",(printbody pos),"]"*)]          | E.Krn(tid,betas,pos) => String.concat[" H",iTos(tid),"^{", String.concat (List.map handleBeta betas),"} [",(printbody pos),"]"]
28          | E.Delta(ix) =>  handleBeta ix          | E.Delta(ix) =>  handleBeta ix
29          | E.Value(ix)=> String.concat["_",iTos(ix),"_"]          | E.Value(ix)=> String.concat["_",iTos(ix),"_"]
30          | 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)]
31          | E.Eps2(ix, jx) => String.concat["ϵ_",iTos(ix), iTos(jx)]          | E.Eps2(ix, jx) => String.concat["ϵ_",iTos(ix), iTos(jx)]
32          | E.Sum ([(v,_,_)],e1)=>String.concat[" Σ_",handleIndex v,"⋐" ,printbody e1,"⋑",handleIndex v]          | E.Sum ([(v,_,_)],e1)=>String.concat[" Σ_",handleIndex v,"⋐" ,printbody e1,"⋑",handleIndex v]
33          | 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,"⋑"]
34          | E.Neg e1 => String.concat["-NEG-", printbody e1]          | E.Neg e1 => String.concat["-NEG-", printbody e1]
35          | E.Lift e1 => String.concat["LIFT ⊢", printbody e1,"⊣"]          | E.Lift e1 => String.concat["LIFT ⊢", printbody e1,"⊣"]
36          | E.Add el => String.concat["(",String.concatWith "+" (List.map printbody el),")"]          | E.Add el => String.concat["(",String.concatWith "+" (List.map printbody el),")"]
37          | E.Sub(e1, e2) => String.concat ["(",printbody(e1),"---- ",printbody(e2)]          | E.Sub(e1, e2) => String.concat ["(",printbody(e1),"---- ",printbody(e2)]
38   | E.Prod el => String.concat["{*{",iTos(length el),String.concatWith "* " (List.map printbody el),"}*}",iTos(length el)]          | E.Prod el => String.concat["{*{",String.concatWith "* " (List.map printbody el),"}*}"]
39          | E.Div(e1,e2) => String.concat ["(",printbody(e1),")/( ",printbody (e2),")"]          | E.Div(e1,e2) => String.concat ["(",printbody(e1),")/( ",printbody (e2),")"]
40          | E.Partial alpha => String.concat["d/dx_",handleAlpha alpha]          | E.Partial alpha => String.concat["d/dx_",handleAlpha alpha]
41          | E.Apply(e1, e2)=> String.concat [ printbody(e1),"@{", printbody(e2),"} "]          | E.Apply(e1, e2)=> String.concat [ printbody(e1),"@{", printbody(e2),"} "]
  (*  
42          | E.Conv(fid,alpha, tid ,[])=> String.concat["|v",iTos(fid),"_{",handleAlpha alpha, "}★h(",iTos(tid),")|"]          | E.Conv(fid,alpha, tid ,[])=> String.concat["|v",iTos(fid),"_{",handleAlpha alpha, "}★h(",iTos(tid),")|"]
                 | E.Conv(fid,alpha, tid, [b0,b1])=> String.concat["|v",iTos(fid),"_{",handleAlpha alpha, "}★h2(",iTos(tid),")dx_",handleAlpha [b0,b1],"}|"]  
43          | E.Conv(fid,alpha, tid, beta)=> String.concat["|v",iTos(fid),"_{",handleAlpha alpha, "}★h(",iTos(tid),")dx_",handleAlpha beta,"}|"]          | E.Conv(fid,alpha, tid, beta)=> String.concat["|v",iTos(fid),"_{",handleAlpha alpha, "}★h(",iTos(tid),")dx_",handleAlpha beta,"}|"]
44   *)          | E.Probe (e1,e2)=> String.concat [printbody(e1),"[", printbody(e2),"]"]
45           | E.Conv(fid,alpha, tid,[])=> String.concat["F_",handleAlpha alpha]          | E.Img (fid,alpha,pos)=> String.concat [" V", iTos(fid),"_",handleAlpha alpha,"[",
46           | E.Conv(fid,alpha, tid, beta)=> String.concat["F_",handleAlpha alpha,"∇",handleAlpha beta]              (String.concatWith "," (List.map printbody pos)),"]"]
         | E.Probe (e1,e2)=> String.concat [printbody(e1)(*,"[", printbody(e2),"]"*)]  
         | E.Img (fid,alpha,pos)=> String.concat [" V", iTos(fid),"_",handleAlpha alpha,"["(*,  
                 (String.concatWith "," (List.map printbody pos)),"]"*)]  
47          | E.Sqrt e => String.concat[ "√(", printbody e ,")"]          | E.Sqrt e => String.concat[ "√(", printbody e ,")"]
48          | E.PowInt(e,n1) => String.concat[  "(",printbody e ,")^",iTos n1]          | E.PowInt(e,n1) => String.concat[  "(",printbody e ,")^",Int.toString n1]
49          | E.PowReal(e,n1) => String.concat[ "(", printbody e ,")^",RationalEin.toString n1]          | E.PowReal(e,n1) => String.concat[ "(", printbody e ,")^",RationalEin.toString n1]
50          | E.Cosine e=>  String.concat["Cosine(",printbody e ,")"]          | E.PowEmb (e,sx,n)=>String.concat["POW(",printbody e,"^", iTos n,")"]
51          | E.ArcCosine e=> String.concat["ArcCosine(",printbody e ,")"]          | E.Trig(t,e)=>(case t
52          | E.Sine e => String.concat["Sine(",printbody e ,")"]              of  E.Cosine =>  String.concat["Cosine(",printbody e ,")"]
53          | E.ArcSine e => String.concat["ArcSine(",printbody e ,")"]              | E.ArcCosine => String.concat["ArcCosine(",printbody e ,")"]
54                | E.Sine  => String.concat["Sine(",printbody e ,")"]
55                | E.ArcSine  => String.concat["ArcSine(",printbody e ,")"]
56                | E.Tangent  => String.concat["Tangent(",printbody e ,")"]
57                | E.ArcTangent => String.concat["ArcTangent(",printbody e ,")"]
58                (*end case*))
59            | E.Exp e1=> String.concat["E^(",printbody e1,")"]
60          (* end case *))          (* end case *))
61    
62      (*printerE:EIN ->string*)      (*printerE:EIN ->string*)
# Line 74  Line 73 
73              | Param(_,_)=""              | Param(_,_)=""
74    
75          in          in
76             String.concat["-EIN-" (*,Param(params, 0)*)," <",printbody(body),">"," _{",Index(index,0),"} "]             String.concat["-EIN-" ,Param(params, 0)," <",printbody(body),">"," _{",Index(index,0),"} "]
77    
78          end          end
79    

Legend:
Removed from v.3276  
changed lines
  Added in v.3440

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