happens (in terms of input and output) during the transition. For example, Figure
1.5 represents a transition from State 1 to State 2, which is taken when the input
symbol is a. With this intuitive picture in mind, let us look at another way of
describing C identifiers.
Figure 1.5
Example 1.16
Figure 1.6 is an automaton that accepts all legal C identifiers. Some
interpretation is necessary. We assume that initially the automaton is in State 1;
we indicate this by drawing an arrow (not originating in any vertex) to this state.
As always, the string to be examined is read left to right, one character at each
step. When the first symbol is a letter or an underscore, the automaton goes into
State 2, after which the rest of the string is immaterial. State 2 therefore
represents the “yes” state of the accepter. Conversely, if the first symbol is a
digit, the automaton will go into State 3, the “no” state, and remain there. In our
solution, we assume that no input other than letters, digits, or underscores is
possible.
Figure 1.6
Compilers and other translators that convert a program from one language to
Précédent

- 52/532

Suivant