Make constructing NFAs and DFAs more usable
This commit is contained in:
parent
02bf60b095
commit
c44f4c090b
2 changed files with 20 additions and 5 deletions
|
|
@ -56,8 +56,10 @@ dfa stateMap entryState =
|
|||
let myDfa = Dfa{stateMap=stateMap, entryState=entryState}
|
||||
in if integrityCheck myDfa then Just myDfa else Nothing
|
||||
|
||||
dfa' :: (Ord s) => [(s, State s t)] -> s -> Maybe (Dfa s t)
|
||||
dfa' states entryState = dfa (Map.fromList states) entryState
|
||||
dfa' :: (Ord s, Ord t) => [(s, [(t, s)], s, Bool)] -> s -> Maybe (Dfa s t)
|
||||
dfa' states entryState =
|
||||
let stateList = map (\(s, ts, dt, a) -> (s, State (Map.fromList ts) dt a)) states
|
||||
in dfa (Map.fromList stateList) entryState
|
||||
|
||||
{-
|
||||
- Executing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue