December 2009
Intermediate to advanced
380 pages
9h 2m
English
| Pattern 18 | Symbol Table for Data Aggregates |
This pattern tracks symbols and builds a scope tree for data aggregates such as C’s structs.
To manage struct scopes, we’ll build a scope tree and define symbols just like we did in Pattern 17, Symbol Table for Nested Scopes. The only difference lies in symbol resolution. Member access expressions like a.b can see fields inside a struct.
In Building Scope Trees for Structs, we examined the scope tree for some sample Cymbol struct definitions. The goal of this pattern is to describe the rules and mechanism for building that scope tree and filling the nodes (scopes) with symbols. To get started, we need a new kind of scope tree node called StructSymbol to represent structs. Here’s ...