Computability and Complexity/Formal Languages/Chomsky Hierarchy/sample DFA inputs

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Sample DFA inputs[edit | edit source]

These examples are for use with the perl DFA emulator provided at the bottom of 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