Class Grammar

java.lang.Object
  extended by Grammar

public class Grammar
extends java.lang.Object


Constructor Summary
Grammar()
          Constructs a new, empty grammar.
 
Method Summary
 void addRule(java.lang.String ruleText)
          Adds definitions for a single nonterminal to this grammar.
 Definitions getDefinitions(java.lang.String nonterminal)
          Returns a list of definitions for the given nonterminal.
 void print()
          Prints this Grammar.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Grammar

public Grammar()
Constructs a new, empty grammar.

Method Detail

addRule

public void addRule(java.lang.String ruleText)
             throws java.lang.IllegalArgumentException
Adds definitions for a single nonterminal to this grammar. The input text should be in the form:

Parameters:
ruleText - The text to be parsed and kept as definitions.
Throws:
java.lang.IllegalArgumentException - If the input parameter has a syntax error.

getDefinitions

public Definitions getDefinitions(java.lang.String nonterminal)
Returns a list of definitions for the given nonterminal.

Parameters:
nonterminal - The nonterminal whose definitions are to be returned.
Returns:
The definitions of the given nonterminal.

print

public void print()
Prints this Grammar.