Can anybody refer me to algorithm for this?
A simulation of a DFSM: Design and implement a program to simulate a DFSM. This program must take two arguments and output ‘yes/no’. The first argument is a file name (the name of a file containing the specification of a DFSM) and the second argument is a string. Both arguments must be command-line arguments. The output of the program is ‘yes’ if the DFSM accepts the string and ‘no’ otherwise. The DFSM specification, given in a file, is structured as follows:
The first line of the file contains the input alphabet separated by one or more spaces. Each alphabet should be a single character.
The transition function is given as a table. The order of the alphabet listing will be the same as the order of the columns of the transition table.
The last line of the file contains the set of final states separated one or more spaces.
The transition function is given between the first and the last lines of the file.
Each row of the transition table will be a line. Elements of the row are separated one or more spaces. Assuming that there are at least three lines in the file, the second line corresponds to the first row of the transition table indexed by state 1. The row indices are implicit starting from the second line of the file. Columns of the table are indexed by the ordering of the alphabet as it appears in the first line. States are denoted by integers starting from 1, which is the start state.
The rows of the transition table are given between the first and last lines of the file with one row per line.
Aucun commentaire:
Enregistrer un commentaire