MOEA Framework 2.12
API Specification

Class Parser

  extended by org.moeaframework.util.grammar.Parser

public class Parser
extends Object

Parses simple context-free grammars in Backus-Naur form (BNF). The following example demonstrates the accepted syntax. Newlines indicate the end of a rule; single and double quotes can be used to escape the control characters (":", "=", "|", "//", etc.); C and C++ style comments are supported.

 <expr> ::= <expr> <op> <expr> | "func(" <expr> ")" | <val>
 <op> ::= + | - | * | '/'
 <val> ::= x | y | z

Method Summary
static ContextFreeGrammar load(Reader reader)
          Parses the context-free grammar.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail


public static ContextFreeGrammar load(Reader reader)
                               throws IOException
Parses the context-free grammar.

reader - the Reader containing the BNF context-free grammar
the grammar
IOException - if an I/O error occurred
GrammarException - if an error occurred parsing the BNF context-free grammar

MOEA Framework 2.12
API Specification

Copyright 2009-2016 MOEA Framework. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage. Visit us on Github!