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 2626, Fri May 16 18:32:52 2014 UTC revision 2627, Sat May 17 00:44:22 2014 UTC
# Line 29  Line 29 
29      fun prln (out, l) = (indent out; prl(out, l))      fun prln (out, l) = (indent out; prl(out, l))
30    
31      fun expToString e = let      fun expToString e = let
32            fun argsToS (lp, args, rp, l) = let            fun argsToS (shift,lp, args, rp, l) = let
33                  fun argToS ([], l) = l                  fun argToS ([], l) = l
34                    | argToS ([e], l) = toS (e, l)                    | argToS ([e], l) = toS (e, l)
35                    | argToS (e::es, l) = toS(e, "," :: argToS(es, l))                    | argToS (e::es, l) = toS(e, shift:: argToS(es, l))
36                  in                  in
37                    lp :: argToS(args, rp :: l)                    lp :: argToS(args, rp :: l)
38                  end                  end
39    
40            and toS (IL.E_State x, l) = IL.stateVarToString x :: l            and toS (IL.E_State x, l) = IL.stateVarToString x :: l
41              | toS (IL.E_Var x, l) = (case (Var.kind x)              | toS (IL.E_Var x, l) = (case (Var.kind x)
42                   of IL.VK_Local => Var.name x :: l                   of IL.VK_Local => Var.name x :: l
43                    | _ => "::" :: Var.name x :: l                    | _ => "::" :: Var.name x :: l
44                  (* end case *))                  (* end case *))
45              | toS (IL.E_Lit lit, l) = Literal.toString lit :: l              | toS (IL.E_Lit lit, l) = Literal.toString lit :: l
46              | toS (IL.E_Op(rator, args), l) = Op.toString rator :: argsToS ("(", args, ")", l)              | toS (IL.E_Op(rator, args), l) = Op.toString rator :: argsToS (",","(", args, ")", l)
47              | 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)
48              | toS (IL.E_Cons(ty, args), l) =              | toS (IL.E_Cons(ty, args), l) =
49                  "<" :: Ty.toString ty :: ">" :: argsToS ("{", args, "}", l)                  "<" :: Ty.toString ty :: ">" :: argsToS (",","{", args, "}", l)
50                | toS (IL.E_LoadVec(tyNew, tyOrig,offset,arg), l) =
51                        "LDVec:" :: Ty.toString tyNew ::"|":: Ty.toString tyOrig::Int.toString(offset)::argsToS (",","(", [arg], ")", l)
52                | toS (IL.E_mkVec(tyNew, tyOrig,pieces,args), l) =let
53                        val m=argsToS (",\n\t","(", args, ")", l)
54                        in "mkVec:" :: Ty.toString tyNew ::"|":: Ty.toString tyOrig::
55                        "[":: Ty.toString pieces ::"\n\t"::m
56                        end
57    
58    
59            in            in
60              String.concat (toS (e, []))              String.concat (toS (e, []))
61            end            end

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

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