org.metasyntactic.math.automata
Class LookAheadParseTable

java.lang.Object
  |
  +--org.metasyntactic.math.automata.LRParseTable
        |
        +--org.metasyntactic.math.automata.LookAheadParseTable
All Implemented Interfaces:
FiniteAutomata, java.io.Serializable

public class LookAheadParseTable
extends LRParseTable

The LALR method is often used in practise because the tables obtained by it are considerably smaller than the CanonicalParseTable, yet most common syntactic constructs of programming languages can be expressed conveniently by an LALR grammar. The same is almost true for SLR grammars, but there are a few constructs that connot be conveniently handled by SLR techniques.

For a comparison of parse size, the SLR and LALR tabes for a grammar always have the same number of states, and tis number is typically several hundred states for a language like Pascal. The CanonicalParseTable would typically have several thousand states for the same size language. Thus, it is more economical to construct SLR and LALR tables than the CanonicalParseTable.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.metasyntactic.math.automata.LRParseTable
LRParseTable.Accept, LRParseTable.Action, LRParseTable.Error, LRParseTable.Reduce, LRParseTable.Shift, LRParseTable.StateAndSymbol
 
Field Summary
 
Fields inherited from class org.metasyntactic.math.automata.LRParseTable
actions, characterClasses, gotos, nonterminals, productionToNum, startState, states, terminals
 
Constructor Summary
LookAheadParseTable(ContextFreeGrammar G)
           
 
Method Summary
protected  java.util.Set getLookAhead(java.util.Set q, Production prod)
           
protected  java.util.Set go(java.util.Set p, java.util.List w)
           
static void main(java.lang.String[] args)
           
 
Methods inherited from class org.metasyntactic.math.automata.LRParseTable
accept, accept, addAccept, addAcceptListener, addError, addErrorListener, addGoto, addProduction, addReduce, addReduceListener, addShift, addShiftListener, addState, getLargeTable, newToString, removeAcceptListener, removeErrorListener, removeReduceListener, removeShiftListener, setStartState, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LookAheadParseTable

public LookAheadParseTable(ContextFreeGrammar G)
                    throws ParseTableConflict
Method Detail

getLookAhead

protected java.util.Set getLookAhead(java.util.Set q,
                                     Production prod)

go

protected java.util.Set go(java.util.Set p,
                           java.util.List w)

main

public static void main(java.lang.String[] args)