Docstoc

lab2

Document Sample
lab2 Powered By Docstoc
					                    CSCE 372 Algorithms, Machines, and Grammars

Program 2: Finite Automaton to Regular Expression
Due: Wednesday, March 13 2002

You may write your code in either Java or C++. The program will read a text file,
specified by the user, which contains the description of a DFA. We will make the
following two assumptions.
Q = {0, 1, …, n-1}
 = {0, 1}

The text file will have the following format.
n               the number of states
i               0  i < n the start state
j1 j2 …jk       0  j1 j2 …jk < n a list of final states
p0 p1           states for and 
p0 p1           states for and 
           
p0 p1           states for n-1and n-1

 For example the input file for the DFA given on page 15 of our text would be
4
0
3
10
21
32
33

The program will compute a regular expression for the DFA and print the input file name
and the regular expression to the file YourName.dat and to the screen.

Notes: The user may wish to test your program on several input files without restarting
your program. The result of each run should be placed in the same output file with at least
one blank line between results.
Grading:
   1. 0-74%: The program is well designed and adequately documented. The program
       compiles and runs and gives a correct answer for some DFAs.
   2. 75-85%: The program does the above and runs correctly for all DFAs.
   3. 86-92%: The program does the above, has user friendly I/O, and is well
       documented. Also it has regular expressions that are “easy” to read (you may wish
       to identify some of the sub expressions that are used.
   4. 93-100%: The program does the above, and includes some simplification of
       regular expressions. This simplification should be explained and displayed with
       test data.

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:0
posted:2/13/2012
language:
pages:1