This is the core algorithm library for study-automata application.
The software is bound for teachers and students to use as a reference for the acquisition of automata theory. It would include these and maybe more features:
- Zongxing Wei https://github.com/RuMaxwell
- Wenbo Shi https://github.com/Swenb
- Chinese
- English (future)
-
Automata simulation (produce result, and step-by-step demonstration)
-
Automata conversion
- DFAs <= NFAs
- DFAs <= ε-NFAs
- DPDAs <= PDAs
-
Automata-Grammar conversion
- D/NFAs <=> Regexes
- DPDAs <=> CFG
-
Simulate the Pumping Lemma
We use ESLint coding standard. It includes using let/const
instead of var
, using function statement instead of function expression, using lambda expression instead of function expression, using class instead of prototype, using 2 spaces to indent, using single-quote to quote a string, using LF to end a line, and so on.
For convenience, all automata will use integers for states and letters/symbols of an automata.
{
"Q": [0, 1, 2],
"S": [0, 1],
"D": [
["0 0", 1],
["0 1", 0],
["1 0", 2],
["1 1", 0],
["2 0", 2],
["2 1", 0]
],
"q0": 0,
"F": [2]
}
Description: This DFA's language accept strings that end with "00", where
- "Q" is the states (q0, q1, ...),
- "S" is the alphabet (Σ),
- "D" is the transfer diagram (δ),
- "q0" is the entry state,
- "F" is the final states.
This will be parsed into an instance of DFA class, and the transfer diagram will be passed directly to construct a new Map instance.
{
"Q": [0, 1, 2],
"S": [0, 1, 2],
"D": [
["0 null", [1, 2]],
["0 0", null],
["0 1", [1]],
["0 2", [2]],
["1 null", null],
["1 0", [0]],
["1 1", [2]],
["1 2", [0, 1]],
["2 null", null],
["2 0", null],
["2 1", null],
["2 2", null]
],
"q0": 0,
"F": [2]
}
Description: This ε-NFA's language is equal to regex ((ε+b)c*(ε+(a+c)))*(ε+b)+c
. In the transfer diagram, we use null
to represent null string (ε) and null set (Φ).
// A DPDA