Contents
Page-10
Prev
Next
Page+10
Index
Structure References
References to parts of structures within
program code are not hard
to handle. The basic principles are:
- Every expression has a type ( symtype).
- Types form a tree structure (a graph when pointers to types are
included, but still treated as a tree).
- The structure references in source code specify a traversal down
the type tree.
- A reference to a part of a structure depends on the type of
the structure; the results of the reference are:
- An address expression for the substructure.
- A new type for the substructure.
(code, type) → (code', type')
Repeated application of this procedure handles even complicated references.
There are several basic cases: arrays, records, and pointers.