208
Pascal 4.0 User’s Guide
9
Undefined or Improper Identifiers
If an identifier is encountered in the input but is undeclared, the error recovery
mechanism replaces it with an identifier of the appropriate class.
Further references to this identifier are summarized at the end of the
containing procedure, function, or at the end of the program. This is the case if
the reference occurs in the main program.
Similarly, if you use an identifier in an inappropriate way, for example, if a
type
identifier is used in an assignment statement,
pc
produces a diagnostic
and inserts an identifier of the appropriate class. Further incorrect references
to this identifier are flagged only if they involve incorrect use in a different
way.
pc
summarizes all incorrect uses in the same way it summarizes uses of
undeclared variables.
Expected Symbols and Malformed Constructs
If none of the corrections mentioned previously appears reasonable, the error
recovery routine examines the input to the left of the point of error to see if
there is only one symbol that can follow this input. If so, the recovery prints a
diagnostic which indicates that the given symbol is expected.
In cases where none of these corrections resolve the problems in the input, the
recovery may issue a diagnostic that indicates “malformed” input. If
necessary,
pc
can then skip forward in the input to a place where analysis can
continue. This process may cause some errors in the missed text to be skipped.
See this example:
The Pascal program,
synerr2.p
. Here
output
is
misspelled, and
a
is given a
FORTRAN-style variable
declaration.
program synerr2_example(input,outpu);
integer a(10)
begin
read(b);
for c := 1 to 10 do
a(c) := b * c
end. { synerr2_example }
Summary of Contents for SunSoft Pascal 4.0
Page 14: ...xiv Pascal 4 0 User s Guide ...
Page 16: ...xvi Pascal 4 0 User s Guide ...
Page 30: ...6 Pascal 4 0 User s Guide 1 ...
Page 160: ...136 Pascal 4 0 User s Guide 6 ...
Page 268: ...244 Pascal 4 0 User s Guide 11 ...
Page 320: ...296 Pascal 4 0 User s Guide B ...
Page 331: ...Index 307 ...
Page 333: ......