signature TEMP = sig eqtype temp val newTemp: unit -> temp val tempToString: temp -> string structure Table : TABLE sharing type Table.key = temp type label val labToString: label -> string val newLabel : unit -> label val namedLabel : string -> label val initialize : unit -> unit end structure Temp :> TEMP where type temp = int and type label = Symbol.symbol = struct type temp = int val temps = ref 100 fun newTemp () = let val t = !temps in temps := t+1; t end structure Table = IntMapTable(type key = int fun getInt n = n) fun tempToString s = "t" ^ Int.toString s type label = Symbol.symbol fun labToString lab = Symbol.name lab local structure F = Format fun postinc x = let val i = !x in x := i+1; i end val labs = ref 0 in fun newLabel() = Symbol.symbol (F.format "L%d" [F.INT (postinc labs)]) fun namedLabel name = Symbol.symbol name fun initialize () = (temps := 100; labs := 0) end end