Chapter 5:Semantic Analysis

Specifications of a type checker .

. A program generated by this grammar is

key : integer;

key mod 1999

. Assume following:

- basic types are char, int, type-error

- all arrays start at 1

- array[256] of char has type expression array(1 .. 256, char)

A program generated by this grammar is:

key : integer ;

key mod 1999

Assumptions:

1. The language has three basic types: char , int and type-error

2. For simplicity, all arrays start at 1. For example, the declaration array[256] of char leads to the type expression array ( 1.. 256, char).