Package org.moeaframework.util.grammar
Class Parser
java.lang.Object
org.moeaframework.util.grammar.Parser
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
-
Method Details
-
load
Parses the context-free grammar.- Parameters:
reader
- theReader
containing the BNF context-free grammar- Returns:
- the grammar
- Throws:
IOException
- if an I/O error occurredGrammarException
- if an error occurred parsing the BNF context-free grammar
-