20.11.2014 Views

Limbaje Formale, Automate şi Compilatoare

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Automate</strong> finite cu ǫ-tranziţii<br />

Automatul determinist echivalent - algoritm<br />

Intrare: Automatul A (cu ǫ - tranziţii) ; Cl(S)<br />

Ie<strong>şi</strong>re: Automatul determinist A ′ = (Q ′ ,Σ,δ ′ , q 0 ′, F′ ), echivalent cu A.<br />

q 0 ′ = Cl({q 0}); Q ′ = {q 0 ′} ;<br />

marcat(q 0 ′) = false; F′ = ∅ ;<br />

if (q 0 ′ ∩ F ≠ ∅) then F′ = F ′ ∪{q 0 ′} ;<br />

while (∃S ∈ Q ′ &&!marcat(S)) { // S este nemarcat<br />

for (a ∈ Σ){<br />

S ′ = Cl(δ(S, a));<br />

δ ′ (S, a) = S ′ ;<br />

if (S ′ ∉ Q ′ ){<br />

Q ′ = Q ′ ∪{S ′ };<br />

marcat(S ′ ) = false;<br />

if (S ′ ∩ F ≠ ∅) then F ′ = F ′ ∪{S ′ } ;<br />

}<br />

}<br />

marcat(S) = true;<br />

}<br />

LFAC (2014-15) Curs 3 10 / 30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!