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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2749 - (download) (annotate)
Wed Oct 1 23:11:09 2014 UTC (5 years, 11 months ago) by cchiw
File size: 1366 byte(s)
added projection function name
(* tree-Src.sml
 *
 * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 *
 * This representation restores the block structure and nested expression syntax
 * of the source language.
 *)

structure toS =
  struct

    structure Src=LowIL
structure SrcOp=LowOps

structure VLow = LowIL.Var
    structure StV = LowIL.StateVar

    fun rhsToString e=(case e
        of Src.STATE x => String.concat["State",StV.name x]
        | Src.VAR x =>  String.concat["var",VLow.name x]
        | Src.LIT lit =>"lit"
        | Src.OP(rator, args) =>"op"^SrcOp.toString rator 
        | Src.APPLY(f, args) =>"apply"
        | Src.CONS(ty, a::args) => "cons"^VLow.name a
        | Src.EINAPP _=> "einapp"
    (*end case*))


    fun ASSIGNtoString(x,e)=String.concat[VLow.name x, "=ASN=",rhsToString e]
    fun SAVEtoString(x,e)=String.concat[StV.name x," =Save= ", VLow.name e]

    fun printNode x=(case x
        of Src.NULL      => "Null"
        | Src.JOIN  _     => "Join"
        | Src.COND _      =>"Cond"
        | Src.COM       _ =>"Comment"
        | Src.ASSIGN{pred,stm,succ}  =>String.concat["ASSIGN ",ASSIGNtoString stm]
        | Src.MASSIGN _   =>"MASSIGN"
        | Src.NEW  _    => "New"
        | Src.SAVE  _     => "Save"
        | Src.EXIT _       =>"Exit"
        | _=> "nothing"
    (*end x *))
    
  end

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