public static final void frontEndMain(SpecObj spec,String fileName,PrintStream syserr) throws FrontEndException {
  try {
    frontEndInitialize(spec,syserr);
    if (doParsing)     frontEndParse(spec,syserr);
    if (doSemanticAnalysis) {
      frontEndSemanticAnalysis(spec,syserr,doLevelChecking);
    }
    ;
  }
 catch (  InitException ie) {
    return;
  }
catch (  ParseException pe) {
    return;
  }
catch (  SemanticException se) {
    return;
  }
catch (  Exception e) {
    syserr.println(e.toString());
    throw new FrontEndException(e);
  }
  return;
}

public static final void frontEndMain ( SpecObj spec , String fileName , PrintStream syserr ) throws FrontEndException { try { frontEndInitialize ( spec , syserr ) ; if ( doParsing ) frontEndParse ( spec , syserr ) ; if ( doSemanticAnalysis ) { frontEndSemanticAnalysis ( spec , syserr , doLevelChecking ) ; } ; } catch ( InitException ie ) { return ; } catch ( ParseException pe ) { return ; } catch ( SemanticException se ) { return ; } catch ( Exception e ) { syserr . println ( e . toString ( ) ) ; throw new FrontEndException ( e ) ; } return ; }
the tlafrontend . frontendmain method processes an entire tla + spec that starts in the file named in " filename " , including all files it refers to directly or indirectly in extends or instance constructs . " filename " is relative to the current directory . it is expected to end with the extension " . tla " ; if it does not , then " . tla " is appended before processing it . this method does ( 1 ) parsing , ( 2 ) semantic analysis , and ( 3 ) level - checking , and returns a specification object , which is the root of the semantic graph of the specification . it also sends progress indications and a text error stream suitable for printing on system . out or system . err to the printstream " syserr " ( unless " syserr " is null ) . the error stream is also saved in errors objects that are components of the specification object returned . the caller may prefer to pass syserr = null , and use the these errors objects to provide feedback to the human spec - writer in some other way . this method returns a specification object , even if warnings , errors , or aborts occurred during processing . ( but the specification may be incomplete , in that not all modules or definitions are processed . ) the specification object returned must be queried by the caller using geterrorlevel ( ) to see what level of problems , if any , occurred during the three phases . any value from geterrorlevel ( ) other than 0 is fatal , and the caller should not use the specification object any more . this method throws a frontendexception if an unexpected runtime error occurs in the frontend . this exception is not thrown for ordinary warning , error , or abort conditions detected during processing - - those are reported in the returned specification object , which must be checked as described above .
