HP SunSoft Pascal 4.0 Manual de usuario Pagina 231

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 333
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 230
Error Diagnostics 207
9
Replacements, Insertions, and Deletions
When Pascal encounters a syntax error in the input text, the compiler invokes
an error recovery procedure. This procedure examines the input text
immediately after the point of error and uses a set of simple corrections to
determine whether or not to allow the analysis to continue. These corrections
involve replacing an input token with a different token or inserting a token.
Most of these changes do not cause fatal syntax errors.
The exception is the insertion of or replacement with a symbol, such as an
identifier or a number; in these cases, the recovery makes no attempt to
determine which identifier or what number should be inserted. Thus, these are
considered fatal syntax errors.
The Pascal program,
synerr.p, which uses ** as an
exponentiation operator
program synerr_example(output);
var i, j are integer;
begin
for j :* 1 to 20 begin
write(j);
i = 2 ** j;
writeln(i))
end
end. { synerr_example }
synerr.p produces a fatal
syntax error when you compile it
because Pascal does not have
an exponentiation operator.
hostname% pc synerr.p
Mon Feb 13 10:56:19 1995 synerr.p:
3 var i, j are integer;
e 18460----------------^--- Replaced identifier with a ':'
6 for j :* 1 to 20 begin
E 18490-----------------^--- Expected keyword (null)
E 18460-----------------^--- Replaced ':' with a identifier
e 18480----------------------------^--- Inserted keyword do
8 i = 2 ** j;
e 18480---------------^--- Inserted keyword if
E 18480----------------------^--- Inserted identifier
e 18480-------------------------^--- Inserted keyword then
9 writeln(i))
e 18450-------------------------^--- Deleted ')'
Vista de pagina 230
1 2 ... 226 227 228 229 230 231 232 233 234 235 236 ... 332 333

Comentarios a estos manuales

Sin comentarios