NFA for (1|0)*00

Non-deterministic and deterministic finite automaton

RegExp = /00$/

Loop Limit =



NFA
01
> aaba
 bcϕ
* cϕϕ
DFA
01
> xyx
 yzx
* zzx
function delta(q, c) { // (1|0)*10
if (q=='a' && c=='0') return 'a'
if (q=='a' && c=='1') return 'ab'
if (q=='b' && c=='0') return 'c'
return ''; //default -- no transition
}
function accept(w, F='c', Q='a') {
//w: input String
//F: final state(s)
//Q: current state(s)
let i = 0, txt = Q
while (i < w.length) {
let c = w[i], T=''
for (let q of Q)
T = union(T, delta(q, c))
Q = T
if (Q == '') break
i++; txt += ", "+c+" -> "+Q+'\n'+Q
}
input.selectionStart = i
input.selectionEnd = i+1
let a = intersect(Q, F).length > 0
return txt+' '+(a? "Accept" : "Reject")
}