Package fri.patterns.interpreter.parsergenerator.lexer

Examples of fri.patterns.interpreter.parsergenerator.lexer.LexerImpl


    // 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);
    }
View Full Code Here

TOP

Related Classes of fri.patterns.interpreter.parsergenerator.lexer.LexerImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.