|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectxtc.tree.Visitor
xtc.parser.CostEstimator
public class CostEstimator
Visitor to provide a conservative estimate for the cost of parsing
a production. One unit of cost is approximately equivalent to the
effort involved in parsing a character and testing it for a
specific value. The cost estimate for a production includes the
costs for any other productions referenced by that production. If
the cost cannot be statically determined (for example, for a
repetition) or a set of productions is mutually recursive, the cost
is assumed to be unlimited, as represented by
Integer.MAX_VALUE. This visitor must be invoked by
visiting a grammar, which clears any previous cost estimates and
annotates each production with its estimated cost.
| Field Summary | |
|---|---|
protected Analyzer |
analyzer
The analyzer utility. |
| Constructor Summary | |
|---|---|
CostEstimator(Analyzer analyzer)
Create a new cost estimator. |
|
| Method Summary | |
|---|---|
protected static int |
add(int e1,
int e2)
Add the two specified estimates. |
java.lang.Integer |
visit(Action a)
Visit the specified action. |
java.lang.Integer |
visit(ActionBaseValue v)
Visit the specified action base value. |
java.lang.Integer |
visit(Binding b)
Visit the specified binding. |
java.lang.Integer |
visit(CharCase c)
Visit the specified character case. |
java.lang.Integer |
visit(CharSwitch sw)
Visit the specified character switch. |
java.lang.Integer |
visit(GenericActionValue v)
Visit the specified generic action value. |
java.lang.Integer |
visit(GenericNodeValue v)
Visit the specified generic node value. |
java.lang.Integer |
visit(GenericRecursionValue v)
Visit the specified generic recursion value. |
void |
visit(Module m)
Visit the specified grammar. |
java.lang.Integer |
visit(NodeMarker m)
Visit the specified node marker. |
java.lang.Integer |
visit(NonTerminal nt)
Visit the specified nonterminal. |
java.lang.Integer |
visit(NullLiteral l)
Visit the specified null literal. |
java.lang.Integer |
visit(Option o)
Visit the specified option. |
java.lang.Integer |
visit(OrderedChoice c)
Visit the specified ordered choice. |
java.lang.Integer |
visit(ParserAction a)
Visit the specified parser action. |
java.lang.Integer |
visit(Predicate p)
Visit the specified predicate. |
java.lang.Integer |
visit(Production p)
Visit the specified production. |
java.lang.Integer |
visit(ProperListValue v)
Visit the specified proper list value. |
java.lang.Integer |
visit(Repetition r)
Visit the specified repetition. |
java.lang.Integer |
visit(Sequence s)
Visit the specified sequence. |
java.lang.Integer |
visit(StringLiteral l)
Visit the specified string literal. |
java.lang.Integer |
visit(StringMatch m)
Visit the specified string match. |
java.lang.Integer |
visit(StringValue v)
Visit the specified string value. |
java.lang.Integer |
visit(Terminal t)
Visit the specified terminal. |
java.lang.Integer |
visit(ValueElement v)
Visit the specified value element. |
java.lang.Integer |
visit(VoidedElement v)
Visit the specified voided element. |
| Methods inherited from class xtc.tree.Visitor |
|---|
dispatch, equals, hashCode, iterate, map, mapInPlace, unableToVisit, visit |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Analyzer analyzer
| Constructor Detail |
|---|
public CostEstimator(Analyzer analyzer)
analyzer - The analyzer utility.| Method Detail |
|---|
public void visit(Module m)
public java.lang.Integer visit(Production p)
public java.lang.Integer visit(OrderedChoice c)
public java.lang.Integer visit(Repetition r)
public java.lang.Integer visit(Option o)
public java.lang.Integer visit(Sequence s)
public java.lang.Integer visit(Predicate p)
public java.lang.Integer visit(VoidedElement v)
public java.lang.Integer visit(Binding b)
public java.lang.Integer visit(StringMatch m)
public java.lang.Integer visit(NonTerminal nt)
public java.lang.Integer visit(StringLiteral l)
public java.lang.Integer visit(CharCase c)
public java.lang.Integer visit(CharSwitch sw)
public java.lang.Integer visit(Terminal t)
public java.lang.Integer visit(NodeMarker m)
public java.lang.Integer visit(Action a)
public java.lang.Integer visit(ParserAction a)
public java.lang.Integer visit(NullLiteral l)
public java.lang.Integer visit(StringValue v)
public java.lang.Integer visit(ProperListValue v)
public java.lang.Integer visit(ActionBaseValue v)
public java.lang.Integer visit(GenericNodeValue v)
public java.lang.Integer visit(GenericActionValue v)
public java.lang.Integer visit(GenericRecursionValue v)
public java.lang.Integer visit(ValueElement v)
protected static int add(int e1,
int e2)
e1 - The first estimate.e2 - The second estimate.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||