1signature Temp = 2sig 3 eqtype temp 4 val newtemp : unit -> temp 5 structure Table : TABLE sharing type Table.key = temp 6 val makestring: temp -> string 7 type label = Symbol.symbol 8 val newlabel : unit -> label 9 val namedlabel : string -> label 10end 11 12structure Temp :> Temp = 13struct 14 type temp = int 15 val temps = ref 100 16 fun newtemp() = let val t = !temps in temps := t+1; t end 17 18 structure Table = IntMapTable(type key = int 19 fun getInt n = n) 20 21 fun makestring t = "t" ^ Int.toString t 22 23 type label = Symbol.symbol 24 25 fun postinc x = let val i = !x in x := i+1; i end 26 val labs = ref 0 27 28 fun resetLabelIndex () = labs := 0 29 30 fun newlabel() = Symbol.newSymbol("L" ^ Int.toString (postinc labs)) 31 val namedlabel = Symbol.newSymbol 32 33end 34