Compiler semantic errors, Format of the error diagnostics, Incompatible types – HP SunSoft Pascal 4.0 User Manual

Page 234

Advertising
background image

210

Pascal 4.0 User’s Guide

9

Compiler Semantic Errors

The following sections explain the typical formats and terminology used in
Pascal error messages.

Format of the Error Diagnostics

In the example program above, the error diagnostics from the Pascal compiler
include the line number in the text of the program, as well as the text of the
error message. While this number is most often the line where the error
occurred, it can refer to the line number containing a bracketing keyword like

end

or

until

. If so, the diagnostic may refer to the previous statement. This

diagnostic occurs because of the method the compiler uses for sampling line
numbers. The absence of a trailing semicolon (

;

) in the previous statement

causes the line number corresponding to the

end

or

until

to become

associated with the statement.

As Pascal is a free-format language, the line number associations can only be
approximate and may seem arbitrary in some cases.

Incompatible Types

Since Pascal is a strongly-typed language, many type errors can occur, which
are called type clashes by the compiler.

The Pascal compiler distinguishes among the following type classes in its
diagnostics:

When you compile

mism.p

, the

end-of-file is reached before an

end

delimiter

hostname% pc mism.p

E 26020-------^--- Malformed declaration

15130-------^--- Unexpected end-of-file - QUIT

array

integer

scalar

boolean

pointer

string

char

real

varying

file

record

Advertising