Configuration
// Symbols to explore.
// (regex character class syntax)
symbols =
/[1-9]/
;
// Initial state(s). Any serializable value
// except arrays.
// Use an array for multiple start states.
startState =
0
;
// Returns next state(s) given current state
// and input symbol.
function transition(state, symbol) {
// Count: accepts sequences summing to 3
if (state + symbol <= 3) { return state + symbol; }
return undefined;
}
// Returns true if state is a valid
// final/accepting state.
function accept(state) {
return state === 3;
}
// (Optional) Returns epsilon transition
// target state(s) from current state.
function epsilon(state) {
}
Visualization
Build an NFA to see the visualization