Files required for this assignment are found in ~zeil/cs355/Assignments/Asst1, or via anonymous ftp at ftp.cs.odu.edu at /pub/zeil/cs355/Assignments/Asst1.
/usr/dict/words on most, if not all Unix systems, is a file containing a listing of words, one per line, used as a "dictionary" for spell checker programs and the like.
"egrep" is a Unix command that scans text files for lines containing a string satisfying a regular expression. For example,
egrep 't(h|r)' /usr/dict/wordswould list all words containing a 't' that is followed by either an 'h' or an 'r'.
Read the man page on egrep and on regexp (i.e., use the commands "man egrep" and "man regexp"). Then answer the following (you can check your answers by actually running egrep, of course):
Answer the above questions in files q1.txt, q2.txt, q3.txt, each containing a single line that, if typed in at a Unix console, would run the egrep command. For example,
egrep 'your*Regular+Expression' /usr/dict/words
[Hint: to match an entire word rather than portions of a word, your regular expression must begin with ^ and end with $.]
dgl is a program that reads grammars and produces programs that emit randomly selected strings chosen from the language described by that grammar. For example,
~zeil/bin/dgl < functions.dgl >! functions.c gcc -o functions functions.c -lm
will produce a program named functions that, when run, spits out C-style function calls (e.g., f(x), g(f(x), z), etc.). dgl is intended for use in generating test data that matches the expected input format of a program under development. The dgl manual is available here. [Only sections 1-5 and 9 are relevant to this assignment.When compiling , you may get some warnings about nrand48. Ignore them.]
Art 35779 039 M 12:55-2:25AM Practicum 66792 541 MWF 9:55-1:00PM Social Implications Computer Science 69411 364 MWF 3:35-2:00AM Introduction for Majors English 78373 443 F 9:30-1:25PM Intermediate Topics 09911 103 MWF 2:15-10:55PM Intermediate Topics 84460 995 MWF 2:45-6:00PM Social Implications[The columns in this report are separated by single tab '\t' characters.]
Note that your grammar from question 5 will become a portion of your answer to this question.
The button below will allow you to submit your solution, either from your Unix account or from whatever machine is running your web browser. Shortly after submitting, you will receive an email with a preliminary grade for the assignment. You may, if you wish, make corrections and resubmit, without penalty, up until the due date of the program.
You may also, from the pages accessed by that button, view my solution to the assignment (once the due date is past).