Java Reference
In-Depth Information
class NodeVisitor
procedure
( n )
foreach c n . getChildren() do call c . accept( this )
visit
C
hildren
end
end
class SemanticsVisitor extends NodeVisitor
procedure
visit
( Identifier id )
59
/
Section 8.8.1 on page 327
/
end
procedure
( IntLiteral intlit )
intlit . type integerType
visit
60
end
procedure
visit
(Assigning assign )
61
/
Section 8.8.2 on page 328
/
end
procedure
visit
(BinaryExpr bexpr )
62
call
( bexpr )
bexpr . type ← binary
visit
C
hildren
R
esult
T
ype
( bexpr . operator , bexpr . le f tType . type , bexpr . rightType . type )
end
procedure
visit
(UnaryExpr uexpr )
63
call
( uexpr )
uexpr . type ← unary
visit
C
hildren
R
esult
T
ype
( uexpr . operator , uexpr . subExpr . type )
end
procedure
visit
(ArrayReferencing ar )
/
Figure 8.37 on page 331
/
end
procedure
visit
(StructReferencing sr )
/
Figure 8.38 on page 331
/
end
end
Figure 8.33: Type checking visitors (Part 1)
 
Search WWH ::




Custom Search