Week 2/37

Exercises on scanners and parsers

  1. Implement and test flex based scanners that:
    • formats text in 80-column blocks, while removing multiple, leading, or trailing blanks;
    • removes all tags from an HTML document; and
    • introduces plausible spelling errors.
  2. Read the flex documentation and discuss the full syntax for regular expressions.
  3. What do the following regular expressions match?
    • \"([^\"])*\"
    • http:[^?]*?
    • [-+]?[0-9]*\.[0-9]+([eE][-+]?[0-9]+)?
  4. Find out about "start conditions" in flex.