com.agentfactory.common.parser
Class Visitor

java.lang.Object
  extended by com.agentfactory.common.parser.Visitor
Direct Known Subclasses:
TargetVisitor

public abstract class Visitor
extends java.lang.Object

This interface should be used to implemnet any visitor classes that you wish to use to traverse the parse tree. Only one method is required, and this method should simply call the accept() method on the associated node object. TODO (Rem Collier): It may, in the future be better to make this an abstract base class and to implement the visit method only once.


Field Summary
protected  AFSession session
           
 
Constructor Summary
Visitor()
           
 
Method Summary
abstract  void endOfStatement()
          This method is invoked by the compiler once the visitor has completed its traversal of a single statement in the language.
abstract  void endOfVisit()
          this method is invoked by the compiler once the visitor has completed its traversal of the entire program.
abstract  void reset()
          This method should be invoked prior to the visitor traversing a program parse tree.
 void setSession(AFSession session)
           
abstract  void visit(Node node)
          This method is invoked to start the tree traversal process, and is invoked for every subsequent node that is visited.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected AFSession session
Constructor Detail

Visitor

public Visitor()
Method Detail

setSession

public void setSession(AFSession session)

reset

public abstract void reset()
This method should be invoked prior to the visitor traversing a program parse tree.


visit

public abstract void visit(Node node)
                    throws SemanticError
This method is invoked to start the tree traversal process, and is invoked for every subsequent node that is visited. The key role of this method is to invoke the accept() method on the corresponding node.

Parameters:
node - the node that should be visited next.
Throws:
SemanticError

endOfStatement

public abstract void endOfStatement()
This method is invoked by the compiler once the visitor has completed its traversal of a single statement in the language.


endOfVisit

public abstract void endOfVisit()
this method is invoked by the compiler once the visitor has completed its traversal of the entire program.