WIP NFA & DFA validation
This commit is contained in:
parent
bb70c3df19
commit
a6ff817156
4 changed files with 30 additions and 2 deletions
11
DFA.fs
11
DFA.fs
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue