COMS W4115
Programming Languages and Translators
Lecture 3: January 28, 2015
Structure of a Compiler & Lexical Analysis


  1. Review
  2. Structure of a compiler
  3. The lexical analyzer
  4. Language theory background
  5. Regular expressions
  6. Tokens/patterns/lexemes/attributes

1. Review

2. Structure of a Compiler

3. The Lexical Analyzer

4. Language Theory Background

5. Regular Expressions

6. Tokens/Patterns/Lexemes/Attributes

7. Practice Problems

  1. What language is denoted by the following regular expressions?
    1. (a*b*)*
    2. a(a|b)*a
    3. (aa|bb)*((ab|ba)(aa|bb)*(ab|ba)(aa|bb)*)*
    4. a(ba|a)*
    5. ab(a|b*c)*bb*a
  2. Construct Lex-style regular expressions for the following patterns.
    1. All lowercase English words with the five vowels in order.
    2. All lowercase English words with exactly one vowel.
    3. All lowercase English words beginning and ending with the substring "ad".
    4. All lowercase English words in which the letters are in strictly increasing alphabetic order.
    5. Strings of the form abxba where x is a string of as, bs, and cs that does not contain ba as a substring.

8. Reading Assignment