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

SCM Repository

[diderot] View of /branches/charisee/src/compiler/mid-to-low/toString.sml
ViewVC logotype

View of /branches/charisee/src/compiler/mid-to-low/toString.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2612 - (download) (annotate)
Wed May 7 02:58:55 2014 UTC (6 years, 9 months ago) by cchiw
File size: 1254 byte(s)
clean up mid-to-low
structure toStringEin = struct
    local

    structure DstIL = LowIL
    structure DstTy = LowILTypes
    structure DstOp = LowOps
    structure Var = LowIL.Var
    structure E = Ein

    in

val testing=0

val bV= ref 0

fun toStringRHS x  = (case DstIL.Var.binding x
    of vb => String.concat[
        "\n Found ", DstIL.vbToString vb,"\n"]
    (* end case *))


fun toStringAssgn(DstIL.ASSGN (x, DstIL.OP(opss,args)))=
       String.concat [(Var.toString x),"==",DstOp.toString opss," : ",(String.concatWith "," (List.map Var.toString args))]
    | toStringAssgn(DstIL.ASSGN(x,DstIL.LIT _))= String.concat[Var.toString  x,"==...Lit"]
    | toStringAssgn(DstIL.ASSGN(x,DstIL.CONS (_, varl)))= let
             val y= List.map (fn e1=> Var.toString e1) varl
            in String.concat[(Var.toString  x),"==",(String.concatWith "," y)] end 
    | toStringAssgn(DstIL.ASSGN (x, _))=String.concat[Var.toString  x,"==","CONS",toStringRHS x]


fun toStringTy(DstTy.IntTy )= "int "
    | toStringTy(DstTy.TensorTy [])= "Real "
    | toStringTy(DstTy.TensorTy(dd))=String.concat[
    "TensorTy[", String.concatWith "," (List.map Int.toString dd), "] "]

fun toStringAll(ty,rator)=
    String.concat([toStringTy ty,"\n", toStringAssgn rator] )
    end 

end

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