/** * This is the starting point of the compiler. * * @param args Command line arguments to control the compiler */ public static void main(String[] args) { try { run(args); } catch (FileNotFoundException e) { System.err.println("FILE NOT FOUND: " + e.getLocalizedMessage()); System.exit(FILE_NOT_FOUND_ERROR); } catch (ParseException e) { System.err.println("PARSE ERROR: " + e.getLocalizedMessage()); System.exit(PARSE_ERROR); } catch (ShadowException e) { System.err.println("ERROR IN FILE: " + e.getLocalizedMessage()); e.printStackTrace(); System.exit(TYPE_CHECK_ERROR); } catch (IOException e) { System.err.println("FILE DEPENDENCY ERROR: " + e.getLocalizedMessage()); e.printStackTrace(); System.exit(TYPE_CHECK_ERROR); } catch (org.apache.commons.cli.ParseException e) { System.err.println("COMMAND LINE ERROR: " + e.getLocalizedMessage()); Arguments.printHelp(); System.exit(COMMAND_LINE_ERROR); } catch (ConfigurationException e) { System.err.println("CONFIGURATION ERROR: " + e.getLocalizedMessage()); Arguments.printHelp(); System.exit(CONFIGURATION_ERROR); } catch (TypeCheckException e) { System.err.println("TYPE CHECK ERROR: " + e.getLocalizedMessage()); System.exit(TYPE_CHECK_ERROR); } catch (CompileException e) { System.err.println("COMPILATION ERROR: " + e.getLocalizedMessage()); System.exit(COMPILE_ERROR); } }