b252eea99ed6cf3edbea15f08a3c8ed126dbe223
[nofib.git] / real / rx / src / FAneg.hs
1 module FAneg
2
3 ( negTNFA
4 )
5
6 where
7
8 import Set
9 import FiniteMap
10
11 import Stuff
12 import Options
13
14 import TA
15 import FAtypes
16
17 import FAconv
18
19 import FAdet
20
21 -------------------------------------------------------------------------
22
23 negTNFA :: Opts -> TNFA Int -> TNFA Int
24 negTNFA opts x =
25 let BDFA cons all starts moves = tnfa2bdfa opts x
26 sink = 1 + maximum (0 : setToList all)
27 all1 = unitSet sink `unionSet` all
28 starts1 = all1 `minusSet` starts
29 moves1 = listToFM
30 [ (t, lookupWithDefaultFM moves sink t)
31 | tc <- setToList cons, n <- [tconarity tc]
32 , args <- setToList (insts (take n (repeat all1)))
33 , t <- [ mksterm tc args ]
34 ]
35 d = BDFA cons all1 starts1 moves1
36 u = bnfa2tnfa opts (bdfa2bnfa opts d)
37 in
38 trinfo opts "neg" u $
39 u
40