coursesolutions
Class CourseTypeSetVisitor

java.lang.Object
  extended by lab7.ReflectiveVisitor
      extended by lab7.NodeVisitor
          extended by coursesolutions.CourseTypeSetVisitor

public class CourseTypeSetVisitor
extends NodeVisitor

Sets the class of all AST nodes


Field Summary
 
Fields inherited from class lab7.ReflectiveVisitor
debug
 
Constructor Summary
CourseTypeSetVisitor()
           
 
Method Summary
 void defaultVisit(java.lang.Object o)
          Pass the visitor down
 void perform(AbstractNode root)
          Here is where semantic analysis happens.
 void setType(java.lang.Object o, Type t)
           
 void visit(AssignTypeRequiring atr)
          Insist both children have the same type, set this note to that type
 void visit(BinaryComputeIsh ei)
          Insist both children have the same type, set this note to that type
 void visit(BoolTypeProducing btp)
           
 void visit(CastNode n)
          Cast node -- insist on type of left child
 void visit(ClassDeclaring c)
           
 void visit(FieldReferencing sr)
           
 void visit(FloatTypeProducing ftp)
           
 void visit(IntTypeProducing itp)
           
 void visit(InvokeIsh inv)
           
 void visit(LocalReferencing r)
          Set this node's type to the type of the reference by symbol-table lookup
 void visit(NewIsh ni)
           
 void visit(ReturnIsh rt)
           
 void visit(StringTypeProducing stp)
           
 void visit(ThisIsh t)
           
 void visit(TypeAsserting rtp)
           
 void visit(UnaryComputeIsh ui)
           
 void visitBothSame(AbstractNode n)
          Make sure both children have the samet ype, then set this node to that type
 
Methods inherited from class lab7.NodeVisitor
err, err, out, out, setPrintStream
 
Methods inherited from class lab7.ReflectiveVisitor
dispatch, performVisit
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CourseTypeSetVisitor

public CourseTypeSetVisitor()
Method Detail

perform

public void perform(AbstractNode root)
Here is where semantic analysis happens. The code below will run this visitor on the tree. If you want to split the work up, then make other visitors and run them from perform

Overrides:
perform in class ReflectiveVisitor

defaultVisit

public void defaultVisit(java.lang.Object o)
Pass the visitor down

Overrides:
defaultVisit in class NodeVisitor

visit

public void visit(NewIsh ni)

visit

public void visit(ClassDeclaring c)

visit

public void visit(ThisIsh t)

visit

public void visit(LocalReferencing r)
Set this node's type to the type of the reference by symbol-table lookup


visit

public void visit(InvokeIsh inv)

visit

public void visit(ReturnIsh rt)

visit

public void visit(FieldReferencing sr)

visit

public void visit(BoolTypeProducing btp)

visit

public void visit(IntTypeProducing itp)

visit

public void visit(FloatTypeProducing ftp)

visit

public void visit(StringTypeProducing stp)

visit

public void visit(TypeAsserting rtp)

visit

public void visit(UnaryComputeIsh ui)

visit

public void visit(BinaryComputeIsh ei)
Insist both children have the same type, set this note to that type


visit

public void visit(CastNode n)
Cast node -- insist on type of left child


visit

public void visit(AssignTypeRequiring atr)
Insist both children have the same type, set this note to that type


visitBothSame

public void visitBothSame(AbstractNode n)
Make sure both children have the samet ype, then set this node to that type


setType

public void setType(java.lang.Object o,
                    Type t)