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 3440, Mon Nov 16 19:16:54 2015 UTC revision 3441, Wed Nov 18 00:24:04 2015 UTC
# Line 17  Line 17 
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 b= (case b
20          of E.Const r => iTos(r)          of E.B(E.Const r) => iTos(r)
21          | E.ConstR r =>RationalEin.toString r          | E.B(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]
         | E.Krn(tid,[],pos) =>String.concat[" H ",iTos(tid),"[",  (printbody pos),"]"]  
         | E.Krn(tid,betas,pos) => String.concat[" H",iTos(tid),"^{", String.concat (List.map handleBeta betas),"} [",(printbody pos),"]"]  
         | 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)]  
         | E.Sum ([(v,_,_)],e1)=>String.concat[" Σ_",handleIndex v,"⋐" ,printbody e1,"⋑",handleIndex v]  
         | E.Sum (sumindex,e1)=>String.concat[" Σ_", String.concatWith ","(List.map handleSumRange sumindex),"⋐" ,printbody e1,"⋑"]  
         | E.Neg e1 => String.concat["-NEG-", printbody e1]  
30          | E.Lift e1 => String.concat["LIFT ⊢", printbody e1,"⊣"]          | E.Lift e1 => String.concat["LIFT ⊢", printbody e1,"⊣"]
31          | E.Add el => String.concat["(",String.concatWith "+" (List.map printbody el),")"]   (*
         | E.Sub(e1, e2) => String.concat ["(",printbody(e1),"---- ",printbody(e2)]  
         | E.Prod el => String.concat["{*{",String.concatWith "* " (List.map printbody el),"}*}"]  
         | E.Div(e1,e2) => String.concat ["(",printbody(e1),")/( ",printbody (e2),")"]  
         | E.Partial alpha => String.concat["d/dx_",handleAlpha alpha]  
         | E.Apply(e1, e2)=> String.concat [ printbody(e1),"@{", printbody(e2),"} "]  
32          | 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),")|"]
33          | 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,"}|"]
34     *)
35            | E.Conv _ => "F"
36            | E.Partial alpha => String.concat["d/dx_",handleAlpha alpha]
37            | E.Apply(e1, e2)=> String.concat [ printbody(e1),"@{", printbody(e2),"} "]
38     (*
39          | E.Probe (e1,e2)=> String.concat [printbody(e1),"[", printbody(e2),"]"]          | E.Probe (e1,e2)=> String.concat [printbody(e1),"[", printbody(e2),"]"]
40          | E.Img (fid,alpha,pos)=> String.concat [" V", iTos(fid),"_",handleAlpha alpha,"[",   *)
41              (String.concatWith "," (List.map printbody pos)),"]"]           | E.Probe (e1,e2)=> String.concat ["Probe(",printbody(e1),")"]
42          | E.Sqrt e => String.concat[ "√(", printbody e ,")"]          | E.Value(ix)=> String.concat["_",iTos(ix),"_"]
43          | E.PowInt(e,n1) => String.concat[  "(",printbody e ,")^",Int.toString n1]          | E.Img (fid,alpha,pos)=> String.concat [" V", iTos(fid),"_",handleAlpha alpha,"[", (String.concatWith "," (List.map printbody pos)),"]"]
44          | E.PowReal(e,n1) => String.concat[ "(", printbody e ,")^",RationalEin.toString n1]          | E.Krn(tid,[],pos) =>String.concat[" H ",iTos(tid),"[",  (printbody pos),"]"]
45          | E.PowEmb (e,sx,n)=>String.concat["POW(",printbody e,"^", iTos n,")"]          | E.Krn(tid,betas,pos) => String.concat[" H",iTos(tid),"^{", String.concat (List.map handleBeta betas),"} [",(printbody pos),"]"]
46          | E.Trig(t,e)=>(case t   (*
47            | E.Sum ([(v,_,_)],e1)=>String.concat[" Σ_",handleIndex v,"⋐" ,printbody e1,"⋑",handleIndex v]
48            | E.Sum (sumindex,e1)=>String.concat[" Σ_", String.concatWith ","(List.map handleSumRange sumindex),"⋐" ,printbody e1,"⋑"]*)
49             | E.Sum (sumindex,e1)=>String.concat[" Σ",printbody e1,"⋑"]
50            | E.Op1(E.Neg, e1) => String.concat["-NEG-", printbody e1]
51            | E.Op1(E.Sqrt ,e )=> String.concat[ "√(", printbody e ,")"]
52            | E.Op1(E.PowInt n1,e) => String.concat[  "(",printbody e ,")^",Int.toString n1]
53            | E.Op1(E.PowReal n1,e) => String.concat[ "(", printbody e ,")^",RationalEin.toString n1]
54            | E.Op1(E.PowEmb (sx,n),e)=>String.concat["POW(",printbody e,"^", iTos n,")"]
55            | E.Op1(E.Exp, e1)=> String.concat["E^(",printbody e1,")"]
56            | E.Op1(t,e)=>(case t
57              of  E.Cosine =>  String.concat["Cosine(",printbody e ,")"]              of  E.Cosine =>  String.concat["Cosine(",printbody e ,")"]
58              | E.ArcCosine => String.concat["ArcCosine(",printbody e ,")"]              | E.ArcCosine => String.concat["ArcCosine(",printbody e ,")"]
59              | E.Sine  => String.concat["Sine(",printbody e ,")"]              | E.Sine  => String.concat["Sine(",printbody e ,")"]
# Line 56  Line 61 
61              | E.Tangent  => String.concat["Tangent(",printbody e ,")"]              | E.Tangent  => String.concat["Tangent(",printbody e ,")"]
62              | E.ArcTangent => String.concat["ArcTangent(",printbody e ,")"]              | E.ArcTangent => String.concat["ArcTangent(",printbody e ,")"]
63              (*end case*))              (*end case*))
64          | E.Exp e1=> String.concat["E^(",printbody e1,")"]          | E.Op2(E.Sub,e1, e2) => String.concat ["(",printbody(e1),"---- ",printbody(e2)]
65            | E.Op2(E.Div,e1,e2) => String.concat ["(",printbody(e1),")/( ",printbody (e2),")"]
66     (*
67            | E.Opn(E.Add, el) => String.concat["(",String.concatWith "+" (List.map printbody el),")"]
68            | E.Opn(E.Prod, el) => String.concat["{*{",String.concatWith "* " (List.map printbody el),"}*}"]*)
69     | E.Opn(E.Add, el) => String.concat["Add(",String.concatWith "+" (List.map printbody el),")"]
70     | E.Opn(E.Prod, el) => String.concat["Prod<",String.concatWith "* " (List.map printbody el),">"]
71    
72          (* end case *))          (* end case *))
73    
74      (*printerE:EIN ->string*)      (*printerE:EIN ->string*)

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

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