CS 5313 Formal Language Theory

advertisement
CS 5313 Formal Language Theory - Fall 2009
Programming assignment #1
10 points
Due date: September 18, 2009, 5 PM
Refer to Exercise 2.2.1 (page 52) in the text-book. Construct a DFA as required in
2.2.1a. Write a function to implement the DFA ( the function receives a string as input
and returns YES or NO). Your main program will read strings in {A, B}* from a file
(one string per line) and in each case decide if the string is accepted by the DFA. If it is
accepted, then output the input string followed by the letter D else output the input string
followed by the letter C. The input file name must be a command line argument (argv[1])
to the program. If a string is not in {A, B}*, an appropriate message should be produced.
Requirements:
1. Implement the transition table explicitly as a 2-dimensional array (30%
penalty).
2. The program must be well documented. Documentation must include
external documentation that describes the DFA (30% penalty).
3. Your program must handle all possible inputs (20% penalty for not handling
input properly).
Submit the source code in plain text form using handin. If the program does not compile,
no points will be given. (So, make sure it runs correctly before submitting.) If the
program does not run correctly (output is not correct or the program abnormally
terminates) in every test case, 80% penalty will be applied. If the program does not run
correctly in some of the test cases, 50% penalty will be applied.
Each student is responsible for his/her work. Program generating tools are not allowed.
Program segments or detailed algorithms should not be shared with other students. Do
not copy complete programs or program segments form the Web. Any violation of this
requirement will be treated as plagiarism and will be dealt with according to the
policy on academic dishonesty stated in the syllabus.
Submit source using the command “handin cs5313 program1 <your_file>” from your csx
account.
Download