Oppolzer - Informatik / Stanford Pascal Compiler


Home       Lebenslauf       Schwerpunkte       Kenntnisse       Seminare       Kunden       Projekte       Produkte       Blog       Stanford Pascal       Kontakt

The Stanford Pascal Compiler / Evolution Steps

Back to Compiler main page

Compiler error messages with additional information

Compiler version: 12.2017

Some compiler messages need additional information. See the following example:


PCINT (Build 1.0 Nov 11 2017 08:49:28) **** STANFORD PASCAL COMPILER, OPPOLZER VERSION OF 09.2017 **** 4 SYNTAX ERROR(S) DETECTED. **** 53 LINE(S) READ, 0 PROCEDURE(S) COMPILED, **** 232 P_INSTRUCTIONS GENERATED, 0.02 SECONDS IN COMPILATION. **** LAST ERROR/WARNING ON LINE --> 53 **** ERROR/WARNING CODES FOR THIS PROGRAM : **** 117 : UNSATISFIED FORWARD REFERENCE **** 168 : UNDEFINED LABEL *** EXIT Aufruf mit Parameter = 4 ***

These errors are reported late, for example: the missing forward reference (for types, for example) can only be shown at the beginning of the next section (for example, the var section).

It is therefore necessary to show the value (the identifier) of the missing reference anywhere. This was done in previous releases by simple additional WRITELN statements to the listing file. See the following example from the 09.2017 version:


10 ) 11 ) 12 ) type PTRX = -> X ; 13 ) PTRF = -> FELD ; 14 ) 15 ) 16 ) var ZAHL1 : INTEGER ; UNDEFINED TYPE: FELD UNDEFINED TYPE: X **** E117 17 356D 1) ZAHL2 : INTEGER ; 18 360D 1) ZAHL3 : INTEGER ;

The newer compiler releases show the error messages on the terminal, so this sort of user information is not practical any more. Furthermore, the new source program scanner PASSCAN supports error messages with parameters, which solves this requirement. To use this, the error messages in the message file PASCAL.MESSAGES need a % char; this is the place, where the additional information has to be inserted. And: the additional information has to be passed as an additional parameter to the PASSCANE procedure (character string of length 32). This, BTW, was the motivation to implement the compiler extension concerning assignments of strings of different lengths.

After the necessary changes to the compiler and to the message file, the compiler output (on the terminal) now looks like this:


PCINT (Build 1.0 Nov 11 2017 08:49:28) **** STANFORD PASCAL COMPILER, OPPOLZER VERSION OF 12.2017 **** 16 var ZAHL1 : INTEGER ; !! +++ Error P117: UNSATISFIED FORWARD REFERENCE (TYPE "FELD") +++ Error P117: UNSATISFIED FORWARD REFERENCE (TYPE "X") 25 begin (* HAUPTPROGRAMM *) ! +++ Error P117: UNSATISFIED FORWARD REFERENCE (TYPE "UNKNOWN") 53 end (* HAUPTPROGRAMM *) . !! +++ Error P168: UNDEFINED LABEL "20" +++ Error P168: UNDEFINED LABEL "10" **** Compiler Summary **** **** 5 Errors. **** 53 LINE(S) READ, 0 PROCEDURE(S) COMPILED, **** 232 P_INSTRUCTIONS GENERATED, 0.06 SECONDS IN COMPILATION. **** Last Error/Warning on Line 53 **** Error/Warning Codes for this Program: **** P117: UNSATISFIED FORWARD REFERENCE (TYPE "%") **** P168: UNDEFINED LABEL "%" *** EXIT Aufruf mit Parameter = 5 ***

The compiler now has no more "uncontrolled" WRITELNs to the listing file (that is, WRITELNs, that are not scheduled by the source program scanner).

Warning: this new feature is not yet available for download; it is only present in the working version and only for Windows, at the moment (11.2017).

Back to Compiler main page