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

SCM Repository

[diderot] View of /branches/vis15/src/compiler/tree-ir/tree-var.sml
ViewVC logotype

View of /branches/vis15/src/compiler/tree-ir/tree-var.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4317 - (download) (annotate)
Sat Jul 30 14:12:14 2016 UTC (4 years, 2 months ago) by jhr
File size: 1072 byte(s)
working on merge: expand tabs to eight spaces
(* tree-var.sml
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2016 The University of Chicago
 * All rights reserved.
 *)

structure TreeVar : sig

    type t = TreeIR.var

    val new : string * TreeTypes.t -> t

    val name : t -> string

    val toString : t -> string

    val ty : t -> TreeTypes.t

    structure Set : ORD_SET where type Key.ord_key = t
    structure Map : ORD_MAP where type Key.ord_key = t

  end = struct

    datatype t = datatype TreeIR.var

    fun new (name, ty) = V{
            name = name,
            id = Stamp.new(),
            ty = ty
          }

    fun name (V{name, ...}) = name

    fun toString (V{name, id, ...}) = concat[name, "$", Stamp.toString id]

    fun ty (V{ty, ...}) = ty

    local
      structure VarOrd =
        struct
          type ord_key = t
          fun compare (V{id=a, ...}, V{id=b, ...}) = Stamp.compare(a, b)
        end
    in
    structure Set = RedBlackSetFn (VarOrd)
    structure Map = RedBlackMapFn (VarOrd)
    end (* local *)

  end

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