{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Ch5 - Chapter 5 Finite Automata 5.1 Finite State Automata s...

This preview shows pages 1–11. Sign up to view the full content.

Chapter 5 Finite Automata

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 5.1 Finite State Automata Capable of recognizing numerous symbol patterns, the class of regular languages Suitable for pattern -recognition type applications, such as the lexical analyzer of a compiler An abstract (computing) machine M , which is implementation independent , can be used to determine the acceptability (the outputs) of input strings (which make up the language of M )
3 Lexical Analyzer Recognizes occurrences of (valid/acceptable) strings concisely Use a (state ) transition diagram for producing lexical analysis routines, e.g., Figure 1 (next page) Use a transition table whose entries provide a summary of a corresponding transition diagram, which consists of rows (representing states ), columns (representing symbols) and EOS (End_of_string) Entries of a transition table contain the values “accept”, “error”, next states. e.g., Figure 3 Can be encode in a program segment , e.g., Figure 2

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 Transition Diagram and Table 3 1 2 letter digit letter digit letter digit EOS 1 3 2 error 2 error error error 3 3 3 accept Figure 2. A transition table constructed from the transition diagram of Figure 1 Figure 1. A transition diagram representing the syntax of a variable name
5 Instruction Sequence State := 1; Read the next symbol from input; While not end-of-string do Case State of 1: If the current symbol is a letter then State := 3, else if the current symbol is a digit then State := 2, else exit to error routine; 2: Exit to error routine; 3: If the current symbol is a letter then State := 3, else if the current symbol is a digit then State := 3, else exit to error routine; Read the next symbol from the input; End while; If State not 3 then exit to error routine; Figure 3. An instruction sequence suggested by the transition diagram of Figure 1 letter digit EOS 1 3 2 error 2 error error error 3 3 3 accept

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6 5.2 Deterministic Finite Automaton DFA (D eterministic F inite A utomaton) is a quintuple M = ( Q , Σ , δ , q 0 , F ), where 1) Q is a finite set of states 229 Σ is a finite set of (machine) alphabet 329 δ is a transitive function from Q x Σ to Q , i.e., δ : Q x Σ Q 4) q 0 Q, is the start state 5) F Q , is the set of final (accepting) states letter digit EOS 1 3 2 error 2 error error error 3 3 3 accept Figure 4. A transition table constructed from the transition diagram of Figure 1
7 Transition Diagram digit 4 1 2 3 5 6 7 digit digit digit digit digit digit E E + - Figure 5. A transition diagram representing the syntax of a real number

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
8 Transition Table digit E + - EOS 1 2 error error error error error 2 2 3 5 error error error 3 4 error error error error error 4 4 error 5 error error error 5 7 error error 6 6 error 6 7 error error error error error 7 7 error error error error accept Table 1. A transition table constructed from the transition diagram of the previous figure
9 Deterministic Finite Automaton state indicator 1 4 5 6 2 3 tape head head moves in this direction control mechanism Figure 6. A representation of a deterministic finite automaton Input tape

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
10
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 29

Ch5 - Chapter 5 Finite Automata 5.1 Finite State Automata s...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online