Atmost2as Matches Strings Alphabet B C Containing Two S Data Dfa State Symbol Dfa Alphabet Q37192558

atMost2As – matches all strings over the alphabet {A,B,C}containing at most
    two A’s

data DFA state symbol = DFA
    { alphabet :: [symbol]
    , states   :: [state]
    , initial :: state
    , transit :: state -> symbol ->state
    , accept   :: state -> Bool
    }

data ABC = A | B | C deriving (Show, Read, Eq, Ord)

— a DFA that accepts all strings over the alphabet {A,B,C}containing at most
— two A’s
atMost2As :: DFA Int ABC
atMost2As = undefined

This is in Haskell and relates to BFAs.


Answer


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.