xtc.parser
Class ReferenceCounter

java.lang.Object
  extended by xtc.tree.Visitor
      extended by xtc.parser.GrammarVisitor
          extended by xtc.parser.ReferenceCounter

public class ReferenceCounter
extends GrammarVisitor

Visitor to fill in meta-data reference counts. This visitor determines the usage and self counts for a grammar's productions. Note that this visitor does not create the meta-data records; they must be created with the meta-data creator before applying this visitor. Further note that the grammar must have been simplified and inlined before applying this visitor. Finally, note that this visitor assumes that the entire grammar is contained in a single module.

Version:
$Revision: 1.22 $
Author:
Robert Grimm

Field Summary
protected  boolean isTransformable
          The flag for whether the current production is a transformable direct left-recursive production.
 
Fields inherited from class xtc.parser.GrammarVisitor
analyzer, isBound, isLastElement, isPredicate, isRepeatedOnce, isTopLevel, isVoided, needsSequence, runtime, transformInPlace
 
Constructor Summary
ReferenceCounter(Runtime runtime, Analyzer analyzer)
          Create a new reference counter.
 
Method Summary
 java.lang.Object visit(Module m)
          Visit the specified grammar.
 Element visit(NonTerminal nt)
          Visit the specified nonterminal.
 Element visit(OrderedChoice c)
          Visit the specified ordered choice.
 
Methods inherited from class xtc.parser.GrammarVisitor
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
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

isTransformable

protected boolean isTransformable
The flag for whether the current production is a transformable direct left-recursive production.

Constructor Detail

ReferenceCounter

public ReferenceCounter(Runtime runtime,
                        Analyzer analyzer)
Create a new reference counter.

Parameters:
runtime - The runtime.
analyzer - The analyzer utility.
Method Detail

visit

public java.lang.Object visit(Module m)
Visit the specified grammar.

Overrides:
visit in class GrammarVisitor

visit

public Element visit(OrderedChoice c)
Visit the specified ordered choice.

Overrides:
visit in class GrammarVisitor

visit

public Element visit(NonTerminal nt)
Visit the specified nonterminal.



Copyright © 2012. All Rights Reserved.