playground/haskell/dfa.hs

26 lines
492 B
Haskell

import Data.Set
data DFA = DFA {
states :: Set String
, sigma :: Set String
, tf :: String -> String -> String
, strt :: String
, final :: Set String
}
instance Show DFA where
show x = show states ++
show sigma ++
"tf" ++ strt ++
show final
tf1 "q0" "1" = "q1"
tf1 "q1" "0" = "q0"
a = fromList [1,1,2,3]
dfa = DFA (fromList ["q0", "q1", "q2", "q3"])
(fromList ["0", "1"])
tf1
"q0"
(fromList ["q3"])