function [b,B,QQ] = run_dfsa(DFSA,str) % B is the acceptance status of the string during the run % QQ is the sequence of states that the automaton traverses % does the given DFSA accept str? % see str2dfsa.m for basic dfsa definitions % note: we will not check alphabet compatibility here % any out-of-range type phenomenon will be treated as a rejection q = DFSA.q0; B = [ismember(q,DFSA.F)]; QQ = [q]; for t=1:length(str) %s = double(str(t)); s = str(t); q = dfsa_delta(DFSA,q,s); B(end+1) = ismember(q,DFSA.F); QQ(end+1) = q; end % THE OLD WAY: %b = 1; t = 1; done = 0; %while (b & (t<=length(str))) % s = double(str(t)); % t = t+1; % q = dfsa_delta(DFSA,q,s); % b = (q ~= DFSA.qd); % keep going if we aren't in the default state %end %if b b = ismember(q,DFSA.F); %end return