dk.brics.grammar.operations
Class TerminalFinder

java.lang.Object
  extended by dk.brics.grammar.operations.TerminalFinder

public class TerminalFinder
extends Object

Finds terminals that may/must occur in derivable strings.

A "may" terminal is one that might occur in some derivation (so the set of derivable strings is included in the Kleene star of the union of the may-terminals). A "must" terminal is one that definitely occurs in every derivation of a string (so for every must-terminal, every derivable string contains a substring that matches the must-terminal). EOF terminals are excluded in both.


Constructor Summary
TerminalFinder(Grammar g)
          Finds the may/must terminals for the given grammar.
 
Method Summary
 AutomataCollection getMayTerminals(Production p)
          Returns the terminals that appear in some derivations from the given production.
 AutomataCollection getMayTerminals(String nt)
          Returns the terminals that appear in some derivations from the given nonterminal.
 AutomataCollection getMustTerminals(Production p)
          Returns the terminals that appear in all derivations from the given production.
 AutomataCollection getMustTerminals(String nt)
          Returns the terminals that appear in all derivations from the given nonterminal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TerminalFinder

public TerminalFinder(Grammar g)
Finds the may/must terminals for the given grammar.

Method Detail

getMayTerminals

public AutomataCollection getMayTerminals(Production p)
Returns the terminals that appear in some derivations from the given production.


getMayTerminals

public AutomataCollection getMayTerminals(String nt)
Returns the terminals that appear in some derivations from the given nonterminal.


getMustTerminals

public AutomataCollection getMustTerminals(Production p)
Returns the terminals that appear in all derivations from the given production.


getMustTerminals

public AutomataCollection getMustTerminals(String nt)
Returns the terminals that appear in all derivations from the given nonterminal.



Copyright © 2005-2008 Anders Møller.