com.inxar.syntacs.automaton.pushdown
Class LR1Constructor

java.lang.Object
  |
  +--com.inxar.syntacs.automaton.pushdown.LRConstructor
        |
        +--com.inxar.syntacs.automaton.pushdown.LR1Constructor
All Implemented Interfaces:
DPAConstructor, Vizualizable

public class LR1Constructor
extends LRConstructor
implements Vizualizable

Concrete implementation of LRConstructor that builds canonical LR1 parse tables. The algorithm used by this class was coded based directly on the Dragon Book.


Constructor Summary
LR1Constructor()
          Constructs an LR1Constructor.
 
Method Summary
 IntSet closure(IntSet set)
          Returns the closure set of the given set of items.
 DPA construct(ContextFreeSet grammar)
          Constructs a DPA.
 IntSet getNextSet(IntSet items)
          Calculates and returns the next set of items for the given set of items.
 void vizualize(GraphViz dot)
          Burn state to the GraphViz instance such that the instance may be visualized in postscript.
 
Methods inherited from class com.inxar.syntacs.automaton.pushdown.LRConstructor
getState, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LR1Constructor

public LR1Constructor()
Constructs an LR1Constructor.
Method Detail

closure

public IntSet closure(IntSet set)
Returns the closure set of the given set of items.

getNextSet

public IntSet getNextSet(IntSet items)
Calculates and returns the next set of items for the given set of items. Each member in the set corresponds the the ID of a grammar symbol.

construct

public DPA construct(ContextFreeSet grammar)
              throws AlgorithmException
Description copied from interface: DPAConstructor
Constructs a DPA.

vizualize

public void vizualize(GraphViz dot)
Description copied from interface: Vizualizable
Burn state to the GraphViz instance such that the instance may be visualized in postscript.
Specified by:
vizualize in interface Vizualizable