Chapter 5:Semantic Analysis

Specifications of a type checker

. Consider a language which consists of a sequence of declarations followed by a single expression

P D ; E

D D ; D | id : T

T char | integer | array [ num] of T | ^ T

E literal | num | E mod E | E [E] | E ^

A type checker is a translation scheme that synthesizes the type of each expression from the types of its sub-expressions. Consider the above given grammar that generates programs consisting of a sequence of declarations D followed by a single expression E.