Java Reference
In-Depth Information
19. Consider the following program fragment:
typedef
struct {
int x,y;
}
*Pair;
Pair *(pairs[23]);
The typedef establishes Pair as a typename, defined as a pointer to a
record of two integers. The declaration for pairs uses the typename, but
adds one more level of indirection to an array of 23 Pairs. Describe how
to implement typedef in C using the techniques presented in Section 8.6.
Your design for typedefmust be accommodate further type construction
using typedefs.
20. Draw a diagram of the symbol table entries, attribute descriptors, and
type descriptors that would result from processing the declarations in
Exercise 19.
21. Extend the
method in Section 8.7.1 to handle the feature in Java that
allows a list of interfaces implemented as part of a class declaration (as
described at the end of that section). Interface declarations themselves
are similar to class declarations. Write a
visit
visit
method for processing
interface declarations.
22. Write the
method that is applied to a list of paramDeclaringnodes,
as described in Section 8.7.2.
visit
23. Section 8.7.2 presented the need for an
method as part of a
symbol table interface in order to add the names in a parent class and its
ancestors to the symbol table of a class. Propose two possible implemen-
tations of
incorporate
incorporate
in its interface and explain their relative advantages and disadvantages.
How will your implementations and analysis have to change to handle
multiple inheritance?
retrieve
S
ymbol
in a symbol table that includes
24. Draw a diagram of the symbol table entries, attribute descriptors and
type descriptors that would result from processing the declaration of
LHSSemanticVisitor in Figure 8.34.
 
Search WWH ::




Custom Search