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, arg, offset), l) = |
| toS (IL.E_Mux(A,nSize,oSize, pieces, args),l) = |
53 |
"LdVec<" :: itos tyNew :: ":" :: itos tyOrig :: ">(" |
"Mux<" ::itos nSize :: ":" :: itos oSize ::"[>\t ]"::argsToS (",","(", args, ")", l) |
54 |
:: argsToS (",", "(", [arg, offset], ")", l) |
|
55 |
| toS (IL.E_mkVec(tyNew, tyOrig, pieces, args), l) =let |
|
56 |
val m = argsToS (",\n\t","(", args, ")", l) |
| toS (IL.E_LoadArr(A,tyNew, tyOrig, arg, offset), l) = |
57 |
in |
"LdArr<" :: itos tyNew :: ":" :: itos tyOrig :: ">(" |
|
"mkVec<" ::itos tyNew :: ":" :: itos tyOrig :: |
|
|
">\n\t" :: m |
|
|
end |
|
|
| toS (IL.E_FillVec(tyNew, tyOrig, arg, offset), l) = |
|
|
"LdVec<" :: itos tyNew :: ":" :: itos tyOrig :: ">(" |
|
|
:: argsToS (",", "(", [arg, offset], ")", l) |
|
|
| toS (IL.E_SliceVec(tyNew, tyOrig, arg, offset), l) = |
|
|
"LdVec<" :: itos tyNew :: ":" :: itos tyOrig :: ">(" |
|
58 |
:: argsToS (",", "(", [arg, offset], ")", l) |
:: 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 |
] |
] |
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; |
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; |
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) |