WIP
This commit is contained in:
parent
a6ff817156
commit
857ef08ace
1 changed files with 10 additions and 2 deletions
12
DFA.fs
12
DFA.fs
|
|
@ -17,11 +17,19 @@ let validateDFA (dfa:DFA) =
|
||||||
let allAcceptingStatesAreStates =
|
let allAcceptingStatesAreStates =
|
||||||
dfa.acceptingStates
|
dfa.acceptingStates
|
||||||
|> List.map (fun x -> List.contains x dfa.states)
|
|> List.map (fun x -> List.contains x dfa.states)
|
||||||
|> List.filter (fun x -> not x)
|
|> List.filter not
|
||||||
|
|> List.length < 1
|
||||||
|
|
||||||
|
let deltaIsComplete =
|
||||||
|
dfa.states
|
||||||
|
|> List.collect (fun x -> dfa.sigma |> List.map (fun y -> (x, y)))
|
||||||
|
|> List.map (fun x -> dfa.delta (fst x) (snd x))
|
||||||
|
|> List.filter (fun x -> not (List.contains x dfa.states))
|
||||||
|> List.length < 1
|
|> List.length < 1
|
||||||
|
|
||||||
List.contains dfa.beginState dfa.states ||
|
List.contains dfa.beginState dfa.states ||
|
||||||
allAcceptingStatesAreStates
|
allAcceptingStatesAreStates ||
|
||||||
|
deltaIsComplete
|
||||||
|
|
||||||
let processChar (dfa: DFA) (state: State) (char: Char) =
|
let processChar (dfa: DFA) (state: State) (char: Char) =
|
||||||
dfa.delta state char
|
dfa.delta state char
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue