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 2869, Thu Feb 12 16:14:22 2015 UTC revision 2870, Wed Feb 25 21:47:43 2015 UTC
# Line 20  Line 20 
20      (*printbody:ein_exp ->string*)      (*printbody:ein_exp ->string*)
21      fun printbody term = (case term      fun printbody term = (case term
22          of E.Const r => iTos(r)          of E.Const r => iTos(r)
23            | E.ConstR r =>RationalEin.toString r
24          | E.Tensor(id, []) =>String.concat[" S",iTos(id)]          | E.Tensor(id, []) =>String.concat[" S",iTos(id)]
25          | E.Tensor(id, alpha) =>String.concat[" T",iTos(id),"_",handleAlpha alpha]          | E.Tensor(id, alpha) =>String.concat[" T",iTos(id),"_",handleAlpha alpha]
26          | E.Field(id, []) =>String.concat[" F",iTos(id)]          | E.Field(id, []) =>String.concat[" F",iTos(id)]
# Line 34  Line 35 
35          | E.Neg e1 => String.concat["-NEG-", printbody e1]          | E.Neg e1 => String.concat["-NEG-", printbody e1]
36          | E.Lift e1 => String.concat["LIFT ⊢", printbody e1,"⊣"]          | E.Lift e1 => String.concat["LIFT ⊢", printbody e1,"⊣"]
37          | E.Add el => String.concat["(",String.concatWith "+" (List.map printbody el),")"]          | E.Add el => String.concat["(",String.concatWith "+" (List.map printbody el),")"]
38          | E.Sub(e1, e2) => String.concat ["(",printbody(e1),"- ",printbody(e2), ")"]          | E.Sub(e1, e2) => String.concat ["(",printbody(e1),"---- ",printbody(e2)]
39          | E.Prod el => String.concat["{{",String.concatWith "* " (List.map printbody el),"}}"]          | E.Prod el => String.concat["(",String.concatWith "* " (List.map printbody el),")"]
40          | E.Div(e1,e2) => String.concat ["(",printbody(e1),"/ ",printbody (e2), ")"]          | E.Div(e1,e2) => String.concat ["(",printbody(e1),")/( ",printbody (e2),")"]
41          | E.Partial alpha => String.concat["d/dx_",handleAlpha alpha]          | E.Partial alpha => String.concat["d/dx_",handleAlpha alpha]
42          | E.Apply(e1, e2)=> String.concat [ printbody(e1),"@{", printbody(e2),"} "]          | E.Apply(e1, e2)=> String.concat [ printbody(e1),"@{", printbody(e2),"} "]
43          | 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),"|"]
44          | E.Conv(fid,alpha, tid, beta)=> String.concat["|v",iTos(fid),"_{",handleAlpha alpha, "}★d/dx_{",handleAlpha beta,"}h",iTos(tid),"|"]          | E.Conv(fid,alpha, tid, beta)=> String.concat["|v",iTos(fid),"_{",handleAlpha alpha, "}★d/dx_{",handleAlpha beta,"}h",iTos(tid),"|"]
45     (*
46            | E.Conv(fid,alpha, tid, beta)=> String.concat["F_",handleAlpha alpha, "★",handleAlpha beta]
47     *)
48          | E.Probe (e1,e2)=> String.concat ["[",printbody(e1), "","[", printbody(e2),"]]"]          | E.Probe (e1,e2)=> String.concat ["[",printbody(e1), "","[", printbody(e2),"]]"]
49          | E.Img (fid,alpha,pos)=> String.concat [" V", iTos(fid),"_",handleAlpha alpha,"[",          | E.Img (fid,alpha,pos)=> String.concat [" V", iTos(fid),"_",handleAlpha alpha,"[",
50                  (String.concatWith "," (List.map printbody pos)),"]"]                  (String.concatWith "," (List.map printbody pos)),"]"]
51    
52          | E.Sqrt e => String.concat[ "√(", printbody e ,")"]          | E.Sqrt e => String.concat[ "√(", printbody e ,")"]
53            | E.PowInt(e,n1) => String.concat[  "(",printbody e ,")^",iTos n1]
54            | E.PowReal(e,n1) => String.concat[ "(", printbody e ,")^",RationalEin.toString n1]
55          (* end case *))          (* end case *))
56    
57      (*printerE:EIN ->string*)      (*printerE:EIN ->string*)

Legend:
Removed from v.2869  
changed lines
  Added in v.2870

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