Java Reference
In-Depth Information
we obtain
b aba | b abb | b ab | b aa | b a b a ( ba | bb | b | a
)
Careful examination of the original FA verifies that this expression correctly
describes it.
3.9 Summary
We have discussed three equivalent and interchangeable mechanisms for
defining tokens: the regular expression, the deterministic finite automaton,
and the nondeterministic finite automaton. Regular expressions are conve-
nient for programmers because they allow the specification of token structure
without regard for implementation considerations. Deterministic finite au-
tomata are useful in implementing scanners because they define token recog-
nition simply and cleanly, on a character-by-character basis. Nondeterministic
finite automata form a middle ground. Sometimes they are used for defini-
tional purposes, when it is convenient to draw a simple automaton as a “flow
diagram” of characters that are to be matched. Sometimes they are directly
executed (see Exercise 17), when translation to deterministic finite automata is
too costly or inconvenient. Familiarity with all three mechanisms will allow
you to use the one best suited to your needs.
 
 
Search WWH ::




Custom Search