9.3 Data Structures

We now discuss how data structures, especially vectors, arrays and records or constructs like struct in C are handled by the code generator. Two aspects of these code constructs are to be considered – the layout of the structure in the memory and run-time access code generation.

9.3.1 Vectors and Arrays

These structures are characterized by having elements of exactly the same size and type, arranged in a linear sequence of consecutive memory addresses. That makes the code generation relatively simple. The elements in the vector or array could be of primitive data types like char, int, float, double, a pointer or it can be a user-defined data type, which may have any arbitrary size.

9.3.2 Vectors

A vector V of elements e of ...

Get Compilers: Principles and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.