Java Reference
In-Depth Information
25. Presuming that Java is the language being compiled, outline the imple-
mentation of
is
A
signable
( dataObect ), as used in the
visit
methods of
LHSSemanticVisitor in Figure 8.34.
26. Recall from Section 8.8 that special checking must be done for names
that are used on the left-hand side of an assignment. The visitor class
LHSSemanticVisitorwas introduced for this purpose. Section 8.8.1 noted
that since a parser will not allow a literal to appear as the target of
an assignment, no
visit
method for handling literals was included in
LHSSemanticVisitor.
For a language of your choice, identify any other contexts in a
program where an L-value is required.
Do the syntactic rules of the language guarantee that a literal can
not appear in these contexts?
Write appropriate LHSSemanticVisitor
methods for the AST
nodes corresponding to any literals allowed by the language.
visit
27. For the language of your choice, outline the implementation of the
method
assignable
( valueType , targetType ), as introduced in the
visit
method for an AssigningAST node in Section 8.8.2.
 
Search WWH ::




Custom Search