WIP NFA & DFA validation

This commit is contained in:
joachimschmidt557 2019-02-06 21:46:02 +01:00
parent bb70c3df19
commit a6ff817156
4 changed files with 30 additions and 2 deletions

11
DFA.fs
View file

@ -12,6 +12,17 @@ type DFA = {
acceptingStates: State list
}
let validateDFA (dfa:DFA) =
let allAcceptingStatesAreStates =
dfa.acceptingStates
|> List.map (fun x -> List.contains x dfa.states)
|> List.filter (fun x -> not x)
|> List.length < 1
List.contains dfa.beginState dfa.states ||
allAcceptingStatesAreStates
let processChar (dfa: DFA) (state: State) (char: Char) =
dfa.delta state char