COMS W4115
Programming Languages and Translators
Lecture 5: Implementing a Lexical Analyzer
February 4, 2015

Outline

  1. Finite automata
  2. Converting an NFA to a DFA
  3. Equivalence of regular expressions and finite automata
  4. Simulating an NFA
  5. The pumping lemma for regular languages
  6. Closure and decision properties of regular languages

1. Finite Automata

2. Converting an NFA to a DFA

3. Equivalence of Regular Expressions and Finite Automata

4. Simulating an NFA

5. The Pumping Lemma for Regular Languages

6. Closure and Decision Properties of Regular Languages

7. Practice Problems

  1. Write down deterministic finite automata for the following regular expressions:
    1. (a*b*)*
    2. (aa|bb)*((ab|ba)(aa|bb)*(ab|ba)(aa|bb)*)*
    3. a(ba|a)*
    4. ab(a|b*c)*bb*a
  2. Construct a deterministic finite automaton that will recognize all strings of 0's and 1's representing integers that are divisible by 3. Assume the empty string represents 0.
  3. Use the McNaughton-Yamada-Thompson algorithm to convert the regular expression a(a|b)*a into a nondeterministic finite automaton.
  4. Convert the NFA of (3) into a DFA.
  5. Minimize the number of states in the DFA of (4).

8. Reading Assignment



aho@cs.columbia.edu