let main () = 
  let argspec = [ ("-debug"Arg.Set Options.debug,
                   " Enable debugging output");
                  ("-show-min-dfa"Arg.Set Options.minimize,
                   " Print NFAs as minimal DFAs during output");  
                  ("-cleanup-nfas"Arg.Set Options.elim,
                   " Remove dead states from NFAs");  
                  ("-no-context-reset"Arg.Clear Options.reset,
                   " Do not reset the environment for each input file");
                  ("-abort-on-error"Arg.Clear Options.noerr,
                   " Do not continue with next input file on error");
                  ("-nfa-cap-size n"Arg.Set_int Options.maxsize,
                   " Minimize NFA intersect operand if it has more than n states")
                ] in
  let argspec = Arg.align argspec in
  let files = ref [] in
  let addinputfile x = files := x::!files in
    Arg.parse argspec addinputfile "Usage: dprle [options] [input files]";
    Printf.printf "%s\n# %s\n" header revision;
    Options.print_options ();
    files := List.rev !files;
    
    match !files with
      | f::fs -> (if not !Options.reset then reset_all (); 
                  List.iter process_file !files)
      | _ -> process_stdin ()