Package fri.patterns.interpreter.parsergenerator

Examples of fri.patterns.interpreter.parsergenerator.Parser


    String [][] syntaxInput = {
      { "Start", "\"Hello\"", "\"World\"" },
      { Token.IGNORED, "`whitespaces`" },
    };
   
    Parser parser = builder.get(syntaxInput);
    boolean ok = parser.parse("Hello World");
    System.err.println("Parsing was "+ok);
  }
View Full Code Here


  };
 
  public static void main(String [] args)
    throws Exception
  {
    Parser parser = new SerializedParser().get(SLRParserTables.class, syntax, "HelloWorld2")// generates "$HOME/.friware/parsers/HelloWorld2Parser.ser"
    parser.setInput("\tHello \r\n\tWorld\n")// give the lexer some very complex input :-)
    parser.parse(new PrintSemantic())// start parsing with a print-semantic
  }
View Full Code Here

    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.Parser

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.