Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/tree-il/tree-il-pp.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/tree-il/tree-il-pp.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2627, Sat May 17 00:44:22 2014 UTC revision 2690, Fri Aug 29 15:41:22 2014 UTC
# Line 28  Line 28 
28      fun prl (out, l) = pr(out, concat l)      fun prl (out, l) = pr(out, concat l)
29      fun prln (out, l) = (indent out; prl(out, l))      fun prln (out, l) = (indent out; prl(out, l))
30    
31        fun itos m = Int.toString m
32    
33      fun expToString e = let      fun expToString e = let
34            fun argsToS (shift,lp, args, rp, l) = let            fun argsToS (shift,lp, args, rp, l) = let
35                  fun argToS ([], l) = l                  fun argToS ([], l) = l
# Line 47  Line 49 
49              | toS (IL.E_Apply(f, args), l) = MathFuns.toString f :: argsToS (",","(", args, ")", l)              | toS (IL.E_Apply(f, args), l) = MathFuns.toString f :: argsToS (",","(", args, ")", l)
50              | toS (IL.E_Cons(ty, args), l) =              | toS (IL.E_Cons(ty, args), l) =
51                  "<" :: Ty.toString ty :: ">" :: argsToS (",","{", args, "}", l)                  "<" :: Ty.toString ty :: ">" :: argsToS (",","{", args, "}", l)
52              | toS (IL.E_LoadVec(tyNew, tyOrig,offset,arg), l) =              | toS (IL.E_Mux(A,nSize,oSize, pieces, args),l) =
53                      "LDVec:" :: Ty.toString tyNew ::"|":: Ty.toString tyOrig::Int.toString(offset)::argsToS (",","(", [arg], ")", l)                      "Mux<" ::itos nSize :: ":" :: itos oSize ::"[>\t ]"::argsToS (",","(", args, ")", l)
             | toS (IL.E_mkVec(tyNew, tyOrig,pieces,args), l) =let  
                     val m=argsToS (",\n\t","(", args, ")", l)  
                     in "mkVec:" :: Ty.toString tyNew ::"|":: Ty.toString tyOrig::  
                     "[":: Ty.toString pieces ::"\n\t"::m  
                     end  
54    
55    
56                | toS (IL.E_LoadArr(A,tyNew, tyOrig, arg, offset), l) =
57                            "LdArr<" :: itos tyNew :: ":" :: itos tyOrig :: ">("
58                                :: argsToS (",", "(", [arg, offset], ")", l)
59            in            in
60              String.concat (toS (e, []))              String.concat (toS (e, []))
61            end            end
62    
63    
64      fun argsToString (prefix, es) = String.concat[      fun argsToString (prefix, es) = String.concat[
65              prefix, "(", String.concatWith "," (List.map expToString es), ")"              prefix, "(", String.concatWith "," (List.map expToString es), ")"
66            ]            ]
# Line 109  Line 110 
110                    List.app (fn s => prln(out, ["// ", s, "\n"])) text                    List.app (fn s => prln(out, ["// ", s, "\n"])) text
111                  end                  end
112              | IL.S_Assign([], e) => prln(out, [expToString e, ";\n"])              | IL.S_Assign([], e) => prln(out, [expToString e, ";\n"])
113              | IL.S_Assign([x], e) => prln(out, [Var.name x, " = ", expToString e, ";\n"])              | IL.S_Assign([x], e) => prln(out, [Var.name x, "=Assign= ", expToString e, ";\n"])
114              | IL.S_Assign(x::xs, e) => (              | IL.S_Assign(x::xs, e) => (
115                  prln(out, ["(", Var.name x]);                  prln(out, ["(", Var.name x]);
116                  List.app (fn x => prl(out, [",", Var.name x])) xs;                  List.app (fn x => prl(out, [",", Var.name x])) xs;
# Line 136  Line 137 
137              | IL.S_New(strand, args) =>              | IL.S_New(strand, args) =>
138                  prln (out, [argsToString("new "^Atom.toString strand, args), ";\n"])                  prln (out, [argsToString("new "^Atom.toString strand, args), ";\n"])
139              | IL.S_Save([x], rhs) =>              | IL.S_Save([x], rhs) =>
140                  prln (out, [IL.stateVarToString x, " = ", expToString rhs, ";\n"])                  prln (out, [IL.stateVarToString x, " =Save= ", expToString rhs, ";\n"])
141              | IL.S_Save(x::xs, e) => (              | IL.S_Save(x::xs, e) => (
142                  prln(out, ["(", IL.stateVarToString x]);                  prln(out, ["(", IL.stateVarToString x]);
143                  List.app (fn x => prl(out, [",", IL.stateVarToString x])) xs;                  List.app (fn x => prl(out, [",", IL.stateVarToString x])) xs;
# Line 161  Line 162 
162              | IL.S_Active => prln (out, ["active;\n"])              | IL.S_Active => prln (out, ["active;\n"])
163              | IL.S_Stabilize => prln (out, ["stabilize;\n"])              | IL.S_Stabilize => prln (out, ["stabilize;\n"])
164              | IL.S_Die => prln (out, ["die;\n"])              | IL.S_Die => prln (out, ["die;\n"])
165                | IL.S_StoreVec(x,A,nSize, oSize, pieces, args) =>
166                       prln(out, "StoreVectoArr1<" ::expToString x:: " = "::itos nSize :: ":" :: itos oSize ::[">\n\t" ])
167            (* end case *))            (* end case *))
168    
169      fun statement (outS, stm) = ppStm((outS, 0), stm)      fun statement (outS, stm) = ppStm((outS, 0), stm)
# Line 196  Line 199 
199              pr (out, "\n")              pr (out, "\n")
200            end            end
201    
202      fun program (outS, IL.Program{props, globals, inputInit, globalInit, strands, initially}) = let      fun program (outS, IL.Program{props,types,oprations, globals, inputInit, globalInit, strands, initially}) = let
203            val out = (outS, 0)            val out = (outS, 0)
204            val out' = incIndent out            val out' = incIndent out
205            in            in

Legend:
Removed from v.2627  
changed lines
  Added in v.2690

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