fr.umlv.tatoo.cc.parser.table
Interface TableFactoryMethod<I extends NodeItem<I>>

All Known Implementing Classes:
LALRTableFactoryMethod, LRTableFactoryMethod, SLRTableFactoryMethod

public interface TableFactoryMethod<I extends NodeItem<I>>


Method Summary
 Grammar buildGrammar(Collection<? extends ProductionDecl> productions, Set<? extends NonTerminalDecl> starts, TerminalDecl eof)
          builds the augmented grammar
 I createStartItem(ProductionDecl production, TerminalDecl eof)
          Create the kernel item for the start states
 NodeClosureComputer<I> getClosureComputer(Grammar grammar, GrammarSets grammarSets, TerminalDecl eof)
          Returns the closure computer for this method
 Set<TerminalDecl> getLookaheads(Grammar g, GrammarSets grammarSets, I item, NodeDecl<I> node)
          returns the set of lookahead corresponding to a reduce action by item
 void initializeComputation(NodeFactory<I> factory, Grammar grammar, GrammarSets grammarSets, TerminalDecl eof)
          Initialize some computation (for LALR)
 

Method Detail

getClosureComputer

NodeClosureComputer<I> getClosureComputer(Grammar grammar,
                                          GrammarSets grammarSets,
                                          TerminalDecl eof)
Returns the closure computer for this method

Parameters:
grammar - the grammar
grammarSets - the grammar sets
eof - the end of file terminal
Returns:
the closure computer for this method

buildGrammar

Grammar buildGrammar(Collection<? extends ProductionDecl> productions,
                     Set<? extends NonTerminalDecl> starts,
                     TerminalDecl eof)
builds the augmented grammar

Parameters:
productions - list of productions
starts - list of starts
eof - terminal eof
Returns:
the grammar

getLookaheads

Set<TerminalDecl> getLookaheads(Grammar g,
                                GrammarSets grammarSets,
                                I item,
                                NodeDecl<I> node)
returns the set of lookahead corresponding to a reduce action by item

Parameters:
g - the grammar
grammarSets - nullable, first and follow sets corresponding to g
item - the item to reduce by
node - the node
Returns:
the set of lookaheads

createStartItem

I createStartItem(ProductionDecl production,
                  TerminalDecl eof)
Create the kernel item for the start states

Parameters:
production - the starting production
eof - the end of file terminal
Returns:
the new item

initializeComputation

void initializeComputation(NodeFactory<I> factory,
                           Grammar grammar,
                           GrammarSets grammarSets,
                           TerminalDecl eof)
Initialize some computation (for LALR)

Parameters:
factory - the factory used to build nodes
grammar - the grammar
grammarSets - grammarSets first and follow sets corresponding the grammar
eof - the end of file terminal