SCM Repository
View of /trunk/src/compiler/ast/var.sml
Parent Directory
|
Revision Log
Revision 171 -
(download)
(annotate)
Sat Jul 24 14:13:10 2010 UTC (11 years, 11 months ago) by jhr
File size: 1095 byte(s)
Sat Jul 24 14:13:10 2010 UTC (11 years, 11 months ago) by jhr
File size: 1095 byte(s)
Adding simple-ast representation
(* var.sml * * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu) * All rights reserved. *) structure Var = struct datatype var = datatype AST.var datatype var_kind = datatype AST.var_kind fun nameOf (V{name, ...}) = name fun typeOf (V{ty, ...}) = ty fun monoTypeOf (V{ty=([], ty), ...}) = ty | monoTypeOf (V{name, ...}) = raise Fail(name ^ " is not monomrphic") fun kindOf (V{kind, ...}) = kind fun new (name, kind, ty) = let val id = Stamp.new() in V{name=Atom.toString name, id=id, kind=kind, ty=([], ty)} end fun newPoly (name, kind, scheme) = let val id = Stamp.new() in V{name=Atom.toString name, id=id, kind=kind, ty=scheme} end fun compare (V{id=a, ...}, V{id=b, ...}) = Stamp.compare(a, b) fun same (V{id=a, ...}, V{id=b, ...}) = Stamp.same(a, b) fun hash (V{id, ...}) = Stamp.hash id local structure V = struct type ord_key = var val compare = compare end in structure Map = RedBlackMapFn (V) structure Set = RedBlackSetFn (V) end end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |