dk.brics.servletvalidator
Class SetCalculatorVisitor
java.lang.Object
dk.brics.servletvalidator.grammar.AbstractGrammarEntityVisitor
dk.brics.servletvalidator.SetCalculatorVisitor
- All Implemented Interfaces:
- GrammarEntityVisitor
public class SetCalculatorVisitor
- extends AbstractGrammarEntityVisitor
Calculates the first and the follow set of all alphabet symbols in the grammar. Assumes that there is
not ε productions in the grammar. Use EpsilonRemovalVisitor to remove
those before calculating first and follow sets. It is also simplified in the sense that the end of file symbol is not added
to the followsets. This is simply because we will not need it for this analysis.
- Author:
- schwarz
| Methods inherited from class dk.brics.servletvalidator.grammar.AbstractGrammarEntityVisitor |
apply, apply, apply, getPath, in, in, in, isMarked, mark, out, print, shouldPrettyPrint |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
grammar
public Grammar grammar
SetCalculatorVisitor
public SetCalculatorVisitor()
apply
public void apply(Grammar g)
- Specified by:
apply in interface GrammarEntityVisitor- Overrides:
apply in class AbstractGrammarEntityVisitor
getFirstSet
public LinkedSet<AlphabetSymbol> getFirstSet(AlphabetSymbol n)
getFirstSets
public Map<AlphabetSymbol,LinkedSet<AlphabetSymbol>> getFirstSets()
getFollowSet
public LinkedSet<AlphabetSymbol> getFollowSet(AlphabetSymbol n)
getFollowSets
public Map<AlphabetSymbol,LinkedSet<AlphabetSymbol>> getFollowSets()
getUsesSet
public Set<Production> getUsesSet(NonTerminal n)
getUsesSets
public Map<NonTerminal,Set<Production>> getUsesSets()
out
public void out(Production production)
- Specified by:
out in interface GrammarEntityVisitor- Overrides:
out in class AbstractGrammarEntityVisitor
out
public void out(Terminal terminal)
- Specified by:
out in interface GrammarEntityVisitor- Overrides:
out in class AbstractGrammarEntityVisitor
reApply
public void reApply()
Copyright © 2008 Mathias Schwarz.