Package fri.patterns.interpreter.parsergenerator.syntax.builder

Examples of fri.patterns.interpreter.parsergenerator.syntax.builder.SyntaxSeparation


 
  /** To be overridden when a modified SyntaxSeparation is needed. */
  protected SyntaxSeparation newSyntaxSeparation(Syntax syntax)
    throws SyntaxException
  {
    return new SyntaxSeparation(syntax);
  }
View Full Code Here


    Syntax syntax = new Syntax(rules);

    try  {
      fri.util.TimeStopper ts = new fri.util.TimeStopper();

      SyntaxSeparation separation = new SyntaxSeparation(syntax);
      LexerBuilder builder = new LexerBuilder(separation.getLexerSyntax(), separation.getIgnoredSymbols());
      Lexer lexer = builder.getLexer();
      lexer.setDebug(true);
      lexer.setTerminals(separation.getTokenSymbols());

      System.err.println("time to build lexer was: "+ts.getInterval());

      InputStream in = ExampleLexer.class.getResourceAsStream("ExampleLexer.java")//Reader in = new FileReader(args[0]);
      lexer.setInput(in);
View Full Code Here

  };
 
  public static void main(String [] args)
    throws Exception
  {
    SyntaxSeparation separation = new SyntaxSeparation(new Syntax(syntax))// separate lexer and parser syntax
    LexerBuilder builder = new LexerBuilder(separation.getLexerSyntax(), separation.getIgnoredSymbols())// build a Lexer
    Lexer lexer = builder.getLexer();
    lexer.setInput("\tHello \r\n\tWorld\n")// give the lexer some very complex input :-)
    ParserTables parserTables = new SLRParserTables(separation.getParserSyntax());
    Parser parser = new Parser(parserTables);
    parser.parse(lexer, new PrintSemantic())// start parsing with a print-semantic
  }
View Full Code Here

TOP

Related Classes of fri.patterns.interpreter.parsergenerator.syntax.builder.SyntaxSeparation

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.