public Program compile( char []input, PrintWriter outError ) { symbolTable = new SymbolTable(); error = new CompilerError( lexer, new PrintWriter(outError) ); lexer = new Lexer(input, error); error.setLexer(lexer); Program p = null; try { lexer.nextToken(); if ( lexer.token == Symbol.EOF ) error.show("Unexpected EOF"); p = program(); if ( lexer.token != Symbol.EOF ) { p = null; error.show("EOF expected"); } } catch ( Exception e ) { // the below statement prints the stack of called methods. // of course, it should be removed if the compiler were // a production compiler. //e.printStackTrace(); } return p; }