This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
dfamin/dfamin.java

38 lines
698 B
Java

import java.io.*;
/**
* @author Andrew Coleman
* Driver class for the DFA minimization object.
*/
public class dfamin {
public static void main ( String[] args ) {
if ( args.length < 1 ) {
System.out.println ( "Usage: java dfamin [inputfile] <outputfile>");
System.exit ( 0 );
}
DFA dfa = new DFA ( args[0] );
dfa.minimize();
if ( args.length > 1 )
{
try
{
PrintWriter out = new PrintWriter ( new FileWriter ( args[1] ) );
out.println ( dfa );
out.flush();
out.close();
}
catch ( Exception exception )
{
System.out.println ( "Exception!" );
exception.printStackTrace();
}
}
else {
System.out.println ( dfa );
}
}
}