6.1 Data Types and Type Checking

The usual data types are integer, float (we purposefully avoid calling them real, as they really are not), character, string, boolean, label, pointer. Some languages have sub-types within some of these types, for example, in C and Java we have short, long and long long sub-types associated with the type integer. Similarly, type double is a sub-type associated with the type float. Usually, arrays of these basic types are also available and form their own type. In many languages, data structures are available as complex data type.

In C, we can have user defined types for arbitrary data structures and complex data types built-up recursively for defined types. For example, in C we can have a declaration float(*pf[]()) ...

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.