Jet.Parser
Class Grammar

java.lang.Object
  extended byJet.Parser.Grammar

public class Grammar
extends java.lang.Object

a context-free grammar.


Constructor Summary
Grammar(java.io.Reader reader)
          constructs a Grammar from the data on reader.
 
Method Summary
 boolean defines(java.lang.String s)
          returns true if symbol s is defined (a non-terminal) in the grammar
 java.util.Vector getProductions(java.lang.String LHS)
          returns the definition of symbol LHS in the grammar, or null if LHS is not defined in the grammar.
 java.util.Vector getProductionsEndingIn(java.lang.Object element)
          returns a Vector of all productions whose last element is element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Grammar

public Grammar(java.io.Reader reader)
        throws java.io.IOException
constructs a Grammar from the data on reader. The grammar consists of a sequence of definitions, each terminated by a semicolon. Each definition has the form
symbol := element element ... | element element ... | ... ; where element is either a symbol or a string enclosed in double quotes ("). Note that each option (elements separated by "|") produces a separate production.

Method Detail

getProductions

public java.util.Vector getProductions(java.lang.String LHS)
returns the definition of symbol LHS in the grammar, or null if LHS is not defined in the grammar. The definition is returned as a vector of Productions.


getProductionsEndingIn

public java.util.Vector getProductionsEndingIn(java.lang.Object element)
returns a Vector of all productions whose last element is element.


defines

public boolean defines(java.lang.String s)
returns true if symbol s is defined (a non-terminal) in the grammar