PLC: Assignment #3

This assignment is due on March 31st.

Question 1

In http://www.cs.rit.edu/~afb/20013/plc/hmwk3/composers.txt
you will find a text file with 794 composers of classical music out of large time period which has been shamelessly stolen from some ancient posting in rec.music.classical. Each line names one composer and specifies the year or the date of birth, possibly followed by the year or the date when the composer died. Some of the years are marked with a question mark as not all dates are known. Here are some examples:

Juan Crisostomo Jacobo Antonio de Arriaga 27.1.1806-17.1.1826
Claude-Benigne Balbastre 1727-1799
Malcolm Arnold 21.10.1921-
Nicola Matteis ?-1714

Implement a Perl script that extracts all composers that lived in a given year (at least partially). Lines with ``?'' are to be ignored. Example:

hilly$ perl living_composers 1485 composers.txt
Josquin des Prez
Clement Janequin
Pierre de la Rue
hilly$
hilly$ perl living_composers 2002 composers.txt | wc -l
      47
hilly$

Question 2

Consider following regular expression for floating point literals:

([0-9][0-9]*\.|\.[0-9])[0-9]*([eE][+-]?[0-9][0-9]*)?[dDfF]?

Convert this into a regular grammar and draw a diagram of the associated DFA for it. You are allowed to tag the arrows with multiple terminals to keep the diagram simple. Likewise you are allowed to use terminals for digits [0-9], letters [eE], [dDfF], and signs [+-] to simplify the regular grammar, i.e. you can write

<A> ---> [0-9] <B>
instead of
<A> ---> 0 <B>
<A> ---> 1 <B>
...
<A> ---> 9 <B>

The DFA diagram must be either plain text (simple ASCII graphics) or something that can be easily viewed, i.e. PostScript, PDF or xfig files. The drawing tool xfig could be helpful here. Make clear what your start symbol or start vertice is if it isn't obvious otherwise. Mark all the final states as such.

Please submit everything in one email that includes all your answers in attachments. Multiple submission emails are permitted but then only the last one is considered.


Andreas F. Borchert, March 25, 2002