// Building lexer from scratch takes 840 millis. Parsing takes 60 millis for a 70 line XML file.
// read the syntax from EBNF file
Reader syntaxInput = new InputStreamReader(XmlLexer.class.getResourceAsStream("Xml.syntax"));
boolean PRODUCTION = false; // always build from scratch at development time
LexerImpl lexer = (LexerImpl) new SerializedLexer(PRODUCTION).get(syntaxInput, "Xml");
System.err.println("time to build XML file parser was "+timer.getInterval());
for (int i = 0; i < args.length; i++) {
String parseFile = args[i];
Reader parseInput = new UnicodeReader(new FileInputStream(parseFile));
lexer.setInput(parseInput);
System.err.println("======================== Parsing: "+parseFile+" ========================");
boolean result = lexer.lex(new PrintXmlLexerSemantic());
System.err.println("========================================================");
System.err.println("Lexing took "+timer.getInterval()+" millis.");
System.err.println("Result was: "+result);
}