1 module FAcmpct 
    2 
    3 ( cmpctBDFA
    4 , cmpctTNFA
    5 )
    6 
    7 where
    8 
    9 import Set
   10 import FiniteMap
   11 
   12 import Stuff
   13 import Options
   14 
   15 import TA
   16 import FAtypes
   17 
   18 import FAmap
   19 
   20 -------------------------------------------------------------
   21 
   22 cmpctBDFA :: Ord a => Opts -> BDFA a -> BDFA Int
   23 -- number states from 0 onwards
   24 cmpctBDFA opts b @ (BDFA cons all starts moves) = 
   25     let h = listToFM (zip (setToList all) [0..])
   26         f = lookupWithDefaultFM h (error "cmpctBDFA")
   27     in  mapBDFA opts f b
   28 
   29 
   30 --cmpctTNFA :: Ord a => Opts -> TNFA a -> TNFA Int
   31 -- number states from 0 onwards
   32 cmpctTNFA opts b @ (TNFA cons all starts moves) = 
   33     let h = listToFM (zip (setToList all) [0..])
   34         f x = lookupWithDefaultFM h 
   35                 (error ("cmpctTNFA doesn't find: " ++ show x))
   36                 x
   37     in  
   38 --      trace ("\ncmpctTNFA.b : " ++ show b) $
   39 
   40         mapTNFA opts f b