AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType > Class Template Reference
[AST Processing]

#include <AstProcessing.h>

Inheritance diagram for AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >:

Inheritance graph
[legend]
Collaboration diagram for AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class InheritedAttributeType, class SynthesizedAttributeType>
class AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >

Attribute Evaluator for inherited and synthesized attributes.

In general, this class combines the classes TopDownProcessing and BottomUpProcessing and also allows to use the inherited attribute of a node in the computation of the synthesized attribute at the same node.

This class allows to compute inherited and synthesized attributes on the AST. It requires an inherited attribute type and a synthesized attribute type as a template parameter and the implementation of the function evaluateInheritedAttribute and evaluateSynthesizedAttribute. The function evaluateInheritedAttribute is invoked in pre-order, the function evaluateSynthesizedAttribute is invoked in post-order while the AST is traversed. The function evaluateSynthesizedAttribute gets as additional parameter the inheritedAttribute value which is computed at the respective node. It can be used to make the computation of the synthesized attribute at a node dependent on the value of the inherited attribute of the same node.

For internal use only.

This class is derived from the SgTreeTraversal class.


Public Types

typedef SgTreeTraversal< InheritedAttributeType,
SynthesizedAttributeType
>::SynthesizedAttributesList 
SynthesizedAttributesList
typedef SynthesizedAttributesList SubTreeSynthesizedAttributes

Public Member Functions

SynthesizedAttributeType traverse (SgNode *node, InheritedAttributeType inheritedValue)
 evaluates attributes on the entire AST
SynthesizedAttributeType traverseWithinFile (SgNode *node, InheritedAttributeType inheritedValue)
 evaluates attributes only at nodes which represent the same file as where the evaluation was started

Protected Member Functions

virtual InheritedAttributeType evaluateInheritedAttribute (SgNode *astNode, InheritedAttributeType inheritedValue)=0
 pure virtual function which must be implemented to compute the inherited attribute at a node
virtual SynthesizedAttributeType evaluateSynthesizedAttribute (SgNode *, InheritedAttributeType, SynthesizedAttributesList)=0
 pure virtual function which must be implemented to compute the synthesized attribute at a node.
virtual void atTraversalStart ()
 Function called at the start of the traversal, before any node is visited; override if necessary, the default implementation is a no-op.
virtual void atTraversalEnd ()

Friends

class AstCombinedTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >


Member Typedef Documentation

template<class InheritedAttributeType, class SynthesizedAttributeType>
typedef SgTreeTraversal<InheritedAttributeType, SynthesizedAttributeType>::SynthesizedAttributesList AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::SynthesizedAttributesList

Reimplemented from SgTreeTraversal< InheritedAttributeType, SynthesizedAttributeType >.

Reimplemented in AstCombinedTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >, AstSharedMemoryParallelizableTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >, AstCombinedTopDownBottomUpProcessing< I, S >, and AstSharedMemoryParallelizableTopDownBottomUpProcessing< I, S >.

template<class InheritedAttributeType, class SynthesizedAttributeType>
typedef SynthesizedAttributesList AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::SubTreeSynthesizedAttributes


Member Function Documentation

template<class InheritedAttributeType, class SynthesizedAttributeType>
SynthesizedAttributeType AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::traverse ( SgNode node,
InheritedAttributeType  inheritedValue 
)

evaluates attributes on the entire AST

template<class InheritedAttributeType, class SynthesizedAttributeType>
SynthesizedAttributeType AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::traverseWithinFile ( SgNode node,
InheritedAttributeType  inheritedValue 
)

evaluates attributes only at nodes which represent the same file as where the evaluation was started

template<class InheritedAttributeType, class SynthesizedAttributeType>
virtual InheritedAttributeType AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::evaluateInheritedAttribute ( SgNode astNode,
InheritedAttributeType  inheritedValue 
) [protected, pure virtual]

pure virtual function which must be implemented to compute the inherited attribute at a node

Implements SgTreeTraversal< InheritedAttributeType, SynthesizedAttributeType >.

Implemented in AttachAllPreprocessingInfoTreeTrav, AttachPreprocessingInfoTreeTrav, FunctionEvaluationOrderTraversal, AstCombinedTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >, and AstCombinedTopDownBottomUpProcessing< I, S >.

template<class InheritedAttributeType, class SynthesizedAttributeType>
virtual SynthesizedAttributeType AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::evaluateSynthesizedAttribute ( SgNode ,
InheritedAttributeType  ,
SynthesizedAttributesList   
) [protected, pure virtual]

pure virtual function which must be implemented to compute the synthesized attribute at a node.

The list of synthesized attributes consists of the synthesized attributes computed at the children node of the current node. The inherited attribute value is computed by evaluateInheritedAttribute at the same node and simply passed to this function. Use the typedef SynthesizedAttributeList as type for the synthesized attributes list.

template<class InheritedAttributeType, class SynthesizedAttributeType>
void AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::atTraversalStart (  )  [protected, virtual]

Function called at the start of the traversal, before any node is visited; override if necessary, the default implementation is a no-op.

Reimplemented from SgTreeTraversal< InheritedAttributeType, SynthesizedAttributeType >.

Reimplemented in AstCombinedTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >, and AstCombinedTopDownBottomUpProcessing< I, S >.

template<class InheritedAttributeType, class SynthesizedAttributeType>
void AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::atTraversalEnd (  )  [protected, virtual]

Reimplemented from SgTreeTraversal< InheritedAttributeType, SynthesizedAttributeType >.

Reimplemented in AstCombinedTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >, AstSharedMemoryParallelizableTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >, AstCombinedTopDownBottomUpProcessing< I, S >, and AstSharedMemoryParallelizableTopDownBottomUpProcessing< I, S >.


Friends And Related Function Documentation

template<class InheritedAttributeType, class SynthesizedAttributeType>
friend class AstCombinedTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType > [friend]


The documentation for this class was generated from the following file:
Generated on Tue Jan 31 05:33:51 2012 for ROSE by  doxygen 1.4.7