Change from State struct to just strings
This commit is contained in:
parent
fa48bc49d1
commit
30949252c0
4 changed files with 36 additions and 40 deletions
|
|
@ -9,23 +9,23 @@ module ContainsSequence =
|
|||
let contains0101:NFA = {
|
||||
sigma = Seq.toList "01";
|
||||
states = [
|
||||
{name = "q0"};
|
||||
{name = "q1"};
|
||||
{name = "q2"};
|
||||
{name = "q3"}
|
||||
{name = "yes"}
|
||||
"q0";
|
||||
"q1";
|
||||
"q2";
|
||||
"q3"
|
||||
"yes"
|
||||
];
|
||||
delta = (fun x y ->
|
||||
match (x, y) with
|
||||
| ({name = "q0"}, '0') -> [{name = "q0"}; {name = "q1"}]
|
||||
| ({name = "q1"}, '1') -> [{name = "q0"}; {name = "q2"}]
|
||||
| ({name = "q2"}, '0') -> [{name = "q0"}; {name = "q3"}]
|
||||
| ({name = "q3"}, '1') -> [{name = "yes"}]
|
||||
| ({name = "yes"}, _) -> [{name = "yes"}]
|
||||
| ("q0", '0') -> ["q0"; "q1"]
|
||||
| ("q1", '1') -> ["q0"; "q2"]
|
||||
| ("q2", '0') -> ["q0"; "q3"]
|
||||
| ("q3", '1') -> ["yes"]
|
||||
| ("yes", _) -> ["yes"]
|
||||
| _ -> []
|
||||
);
|
||||
beginState = {name = "q0"};
|
||||
acceptingStates = [{name = "yes"}]
|
||||
beginState = "q0";
|
||||
acceptingStates = ["yes"]
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue