< Computability and Complexity < Formal Languages < Chomsky Hierarchy

Sample DFA inputs

These examples are for use with the perl DFA emulator provided at the bottom of Computability_and_Complexity/Formal_Languages/Chomsky_Hierarchy/Regular_Languages. That page also contains a description of what a DFA is and how it works.

The specifications for a machine that accepts all strings ending in b:  :States:

q1 q2 q3

 :Start State:

q1

 :Accept States:

q3

 :alphabet:

a b

 :rules:

q1 a q2
q1 b q3
q2 a q2
q2 b q3
q3 a q2
q3 b q3

Some sample words:

this accepts:

b a b a b

this rejects:

a a b b a a b a
(the empty string)

back

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.