Chapter 5:Semantic Analysis

Type expression

. Type of a language construct is denoted by a type expression

. It is either a basic type or it is formed by applying operators called type constructor to other type expressions

. A type constructor applied to a type expression is a type expression

. A basic type is type expression

- type error : error during type checking

- void : no type value

The type of a language construct is denoted by a type expression. A type expression is either a basic type or is formed by applying an operator called a type constructor to other type expressions. Formally, a type expression is recursively defined as:

1. A basic type is a type expression. Among the basic types are boolean , char , integer , and real . A special basic type, type_error , is used to signal an error during type checking. Another special basic type is void which denotes "the absence of a value" and is used to check statements.

2. Since type expressions may be named, a type name is a type expression.

3. The result of applying a type constructor to a type expression is a type expression.

4. Type expressions may contain variables whose values are type expressions themselves.