go to previous page   go to home page   go to next page

Answer:

See below.


Adding Actions

URL Automaton

The automaton is not yet a scanner. It needs a buffer to hold characters of the URL as they are collected. It needs actions added to some transitions. The actions will copy characters into the buffer as the URL is recognized.

Say that you want the first part of the URL to be returned in lower case http:// regardless of how it is in the file. To do this, initialize the buffer to contain http:// only after a complete version of it has been recognized.

The actions needed are:

  1. initialize the buffer, and
  2. store each character of the string that follows up to the first whitespace character

QUESTION 8:

Mentally add the two actions to the digram.