/* fsaprune.c 27/10/98. * * 26/12/99 introduce -i option to do the opposite, and remove all states * that are not targets. * * Removes all states of an fsa from which the accepted language is finite. * * SYNOPSIS: * fsaprune [-ip d/s] [-op d/s] [-silent] [-v] [-a] [-i] [filename]\n"); * Input is from filename or stdin, which should contain a fsa, * output is to filename.prune (or filename.iprune when -i called) or stdout. * * OPTIONS: * -a make all states of input fsa accepting - algorithm is * easier in this case. * -i instead, remove all states that are not the targets of * any transition, and then make all states initial. The * resulting fsa will be a midfa in this case. * -is n change initial state of fsa to n. * -ip d/s input in dense or sparse format - dense is default * -op d/s output in dense or sparse format - default is as in current * value of table->printing_format, in the fsa. * -v verbose * -silent no diagnostics
*/
fsa_read(rfile, &testfsa, ip_store, 0, 0, TRUE, fsaname); if (stringlen(inf))
fclose(rfile);
ns = testfsa.states->size;
ne = testfsa.alphabet->size; if (all_accepting) {
tfree(testfsa.accepting);
testfsa.num_accepting = ns;
}
all_accepting = testfsa.num_accepting == ns;
/* The state deletions may destroy various properties of the automata */
testfsa.flags[MINIMIZED] = FALSE;
testfsa.flags[BFS] = FALSE;
testfsa.flags[ACCESSIBLE] = FALSE;
testfsa.flags[TRIM] = FALSE;
if (stringlen(inf) != 0)
fclose(wfile); if (wfile != stdout && kbm_print_level > 0)
printf("#Pruned fsa with %d states computed.\n", testfsa.states->size);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.