Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/compiler/FLINT/cps/switch.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/FLINT/cps/switch.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 651, Thu Jun 1 18:34:03 2000 UTC revision 772, Thu Jan 4 15:36:41 2001 UTC
# Line 236  Line 236 
236     end     end
237    
238   fun coalesce(l:(string * 'a)list) : (int * (string * 'a) list) list = let   fun coalesce(l:(string * 'a)list) : (int * (string * 'a) list) list = let
239       val l' as (s,_)::_ =       val l' = ListMergeSort.sort (fn ((s1,_),(s2,_)) => size s1 > size s2) l
240         ListMergeSort.sort (fn ((s1,_),(s2,_)) => size s1 > size s2) l       val s = #1 (List.hd l')
241       fun gather(n,[],current,acc) = (n,current)::acc       fun gather(n,[],current,acc) = (n,current)::acc
242         | gather(n,(x as (s,a))::rest,current,acc) = let val s1 = size s         | gather(n,(x as (s,a))::rest,current,acc) = let val s1 = size s
243           in           in
# Line 250  Line 250 
250    
251   fun string_switch(w,l,default) =   fun string_switch(w,l,default) =
252    let fun strip (L.STRINGcon s, x) = (s,x)    let fun strip (L.STRINGcon s, x) = (s,x)
253            | strip _ = bug "string_switch"
254        val b = map strip l        val b = map strip l
255    
256        val bylength = coalesce b        val bylength = coalesce b
# Line 297  Line 298 
298        case c        case c
299         of L.INTcon _ =>         of L.INTcon _ =>
300               let fun un_int(L.INTcon i, e) = (i,e)               let fun un_int(L.INTcon i, e) = (i,e)
301                       | un_int _ = bug "un_int"
302                in int_switch(exp,map un_int cases,default,NONE)                in int_switch(exp,map un_int cases,default,NONE)
303               end               end
304          | L.REALcon _ => real_switch(exp,cases,default)          | L.REALcon _ => real_switch(exp,cases,default)

Legend:
Removed from v.651  
changed lines
  Added in v.772

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