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

branches/charisee/src/compiler/ein/printer.sml revision 3152, Fri Mar 27 17:41:18 2015 UTC branches/charisee_dev/src/compiler/ein/printer.sml revision 3459, Mon Nov 23 19:29:51 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
20      (*printbody:ein_exp ->string*)          of E.B(E.Const r) => iTos(r)
21      fun printbody term = (case term          | E.B(E.ConstR r) =>RationalEin.toString r
         of E.Const r => iTos(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.G(E.Delta(ix)) =>  handleBeta ix
25            | E.G(E.Epsilon(ix, jx, kx)) => String.concat["ϵ_",iTos(ix), iTos(jx), iTos(kx)]
26            | E.G(E.Eps2(ix, jx)) => String.concat["ϵ_",iTos(ix), iTos(jx)]
27    
28          | E.Field(id, []) =>String.concat[" F",iTos(id)]          | E.Field(id, []) =>String.concat[" F",iTos(id)]
29          | E.Field(id, alpha) =>String.concat[" F",iTos(id),"_",handleAlpha alpha]          | E.Field(id, alpha) =>String.concat[" F",iTos(id),"_",handleAlpha alpha]
30            | E.Lift e1 => String.concat["LIFT ⊢", printbody e1,"⊣"]
31    
32            | E.Conv(fid,alpha, tid ,[])=> String.concat["|v",iTos(fid),"_{",handleAlpha alpha, "}★h(",iTos(tid),")|"]
33            | E.Conv(fid,alpha, tid, beta)=> String.concat["|v",iTos(fid),"_{",handleAlpha alpha, "}★h(",iTos(tid),")dx_",handleAlpha beta,"}|"]
34     (*
35            | E.Conv _ => "F"
36     *)
37            | E.Partial alpha => String.concat["d/dx_",handleAlpha alpha]
38            | E.Apply(e1, e2)=> String.concat [ printbody(e1),"@{", printbody(e2),"} "]
39     (*
40            | E.Probe (e1,e2)=> String.concat [printbody(e1),"[", printbody(e2),"]"]
41     *)
42             | E.Probe (e1,e2)=> String.concat ["Probe(",printbody(e1),")"]
43            | E.Value(ix)=> String.concat["_",iTos(ix),"_"]
44            | E.Img (fid,alpha,pos)=> String.concat [" V", iTos(fid),"_",handleAlpha alpha,"[", (String.concatWith "," (List.map printbody pos)),"]"]
45          | E.Krn(tid,[],pos) =>String.concat[" H ",iTos(tid),"[",  (printbody pos),"]"]          | E.Krn(tid,[],pos) =>String.concat[" H ",iTos(tid),"[",  (printbody pos),"]"]
46          | 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),"]"]
47          | E.Delta(ix) =>  handleBeta ix  
         | E.Value(ix)=> String.concat["_",iTos(ix),"_"]  
         | E.Epsilon(ix, jx, kx) => String.concat["ϵ_",iTos(ix), iTos(jx), iTos(kx)]  
         | E.Eps2(ix, jx) => String.concat["ϵ_",iTos(ix), iTos(jx)]  
48          | E.Sum ([(v,_,_)],e1)=>String.concat[" Σ_",handleIndex v,"⋐" ,printbody e1,"⋑",handleIndex v]          | E.Sum ([(v,_,_)],e1)=>String.concat[" Σ_",handleIndex v,"⋐" ,printbody e1,"⋑",handleIndex v]
49          | 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,"⋑"]
50          | E.Neg e1 => String.concat["-NEG-", printbody e1]   (*
51          | E.Lift e1 => String.concat["LIFT ⊢", printbody e1,"⊣"]           | E.Sum (sumindex,e1)=>String.concat[" Σ",printbody e1,"⋑"]
52          | E.Add el => String.concat["(",String.concatWith "+" (List.map printbody el),")"]   *)
53          | E.Sub(e1, e2) => String.concat ["(",printbody(e1),"---- ",printbody(e2)]          | E.Op1(E.Neg, e1) => String.concat["-NEG-", printbody e1]
54          | E.Prod el => String.concat["(",String.concatWith "* " (List.map printbody el),")"]          | E.Op1(E.Sqrt ,e )=> String.concat[ "√(", printbody e ,")"]
55          | E.Div(e1,e2) => String.concat ["(",printbody(e1),")/( ",printbody (e2),")"]          | E.Op1(E.PowInt n1,e) => String.concat[  "(",printbody e ,")^",Int.toString n1]
56          | E.Partial alpha => String.concat["d/dx_",handleAlpha alpha]          | E.Op1(E.PowReal n1,e) => String.concat[ "(", printbody e ,")^",RationalEin.toString n1]
57          | E.Apply(e1, e2)=> String.concat [ printbody(e1),"@{", printbody(e2),"} "]          | E.Op1(E.PowEmb (sx,n),e)=>String.concat["POW(",printbody e,"^", iTos n,")"]
58          | E.Conv(fid,alpha, tid ,[])=> String.concat["|v",iTos(fid),"_{",handleAlpha alpha, "}★h",iTos(tid),"|"]          | E.Op1(E.Exp, e1)=> String.concat["E^(",printbody e1,")"]
59          | E.Conv(fid,alpha, tid, beta)=> String.concat["|v",iTos(fid),"★",handleAlpha beta,"}|"]          | E.Op1(t,e)=>(case t
60          | E.Probe (e1,e2)=> String.concat ["[",printbody(e1), "","[", printbody(e2),"]]"]              of  E.Cosine =>  String.concat["Cosine(",printbody e ,")"]
61          | E.Img (fid,alpha,pos)=> String.concat [" V", iTos(fid),"_",handleAlpha alpha,"[",              | E.ArcCosine => String.concat["ArcCosine(",printbody e ,")"]
62                  (String.concatWith "," (List.map printbody pos)),"]"]              | E.Sine  => String.concat["Sine(",printbody e ,")"]
63          | E.Sqrt e => String.concat[ "√(", printbody e ,")"]              | E.ArcSine  => String.concat["ArcSine(",printbody e ,")"]
64          | E.PowInt(e,n1) => String.concat[  "(",printbody e ,")^",iTos n1]              | E.Tangent  => String.concat["Tangent(",printbody e ,")"]
65          | E.PowReal(e,n1) => String.concat[ "(", printbody e ,")^",RationalEin.toString n1]              | E.ArcTangent => String.concat["ArcTangent(",printbody e ,")"]
66          | E.Cosine e=>  String.concat["Cosine(",printbody e ,")"]              (*end case*))
67          | E.ArcCosine e=> String.concat["ArcCosine(",printbody e ,")"]          | E.Op2(E.Sub,e1, e2) => String.concat ["(",printbody(e1),"---- ",printbody(e2)]
68          | E.Sine e => String.concat["Sine(",printbody e ,")"]          | E.Op2(E.Div,e1,e2) => String.concat ["(",printbody(e1),")/( ",printbody (e2),")"]
69          | E.ArcSine e => String.concat["ArcSine(",printbody e ,")"]   (*
70            | E.Opn(E.Add, el) => String.concat["(",String.concatWith "+" (List.map printbody el),")"]
71            | E.Opn(E.Prod, el) => String.concat["{*{",String.concatWith "* " (List.map printbody el),"}*}"]*)
72     | E.Opn(E.Add, el) => String.concat["Add(",String.concatWith "+" (List.map printbody el),")"]
73     | E.Opn(E.Prod, el) => String.concat["Prod<",String.concatWith "* " (List.map printbody el),">"]
74    
75          (* end case *))          (* end case *))
76    
77      (*printerE:EIN ->string*)      (*printerE:EIN ->string*)
# Line 70  Line 89 
89    
90          in          in
91              String.concat["-EIN-" ,Param(params, 0)," <",printbody(body),">"," _{",Index(index,0),"} "]              String.concat["-EIN-" ,Param(params, 0)," <",printbody(body),">"," _{",Index(index,0),"} "]
92    
93          end          end
94    
95      end (* local *)      end (* local *)

Legend:
Removed from v.3152  
changed lines
  Added in v.3459

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