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

Extending PASSNAP aka SNAPSHOT

As mentioned before, PASSNAP had to be extended to be able to show the static variables, too.

When doing those changes to PASSNAP, I did some other reworking, too:

I furthermore wanted PASSNAP to output the offsets and addresses of the variables, too - and the storage class (auto or static).

See the following example output of PASSNAP and compare it to the output of the same program (same Snapshot) in the 1979 Stanford documentation - see below in the Documentation paragraph. I added some static definitions in the main program and in the FIBONACCI procedure, which - of course - were not present in 1979.


fibonacci # 10 is ************************* ***** SNAPSHOT DUMP ***** ************************* **** SNAPSHOT WAS CALLED BY --> 'PASCAL_MONITOR' **** RUN ERROR: 1002 FROM LINE: 37 OF PROCEDURE: 'FIBONACCI' EPA address of FIBONACCI is 000205A8 Error offset is 00B4 **** SUBRANGE VALUE IS OUT OF RANGE. **** THE OFFENDING VALUE: -1 IS NOT IN THE RANGE: 0..30 **** VARIABLES FOR 'FIBONACCI *** Stack at address 0002B590 Static variables at address 00020598 J (A/0070/0002B600) = 2 ANZCALL (S/0008/000205A0) = 10 **** PROCEDURE 'FIBONACCI' WAS CALLED BY --> 'FIBONACCI' FROM LINE: 37 EPA address of FIBONACCI is 000205A8 Call offset is 0098 **** VARIABLES FOR 'FIBONACCI *** Stack at address 0002B518 Static variables at address 00020598 J (A/0070/0002B588) = 3 ANZCALL (S/0008/000205A0) = 10 **** PROCEDURE 'FIBONACCI' WAS CALLED BY --> 'FIBONACCI' FROM LINE: 37 EPA address of FIBONACCI is 000205A8 Call offset is 0098 **** VARIABLES FOR 'FIBONACCI *** Stack at address 0002B4A0 Static variables at address 00020598 J (A/0070/0002B510) = 4 ANZCALL (S/0008/000205A0) = 10 **** PROCEDURE 'FIBONACCI' WAS CALLED BY --> 'FIBONACCI' FROM LINE: 37 EPA address of FIBONACCI is 000205A8 Call offset is 0098 **** VARIABLES FOR 'FIBONACCI *** Stack at address 0002B428 Static variables at address 00020598 J (A/0070/0002B498) = 5 ANZCALL (S/0008/000205A0) = 10 **** PROCEDURE 'FIBONACCI' WAS CALLED BY --> 'FIBONACCI' FROM LINE: 37 EPA address of FIBONACCI is 000205A8 Call offset is 0098 **** VARIABLES FOR 'FIBONACCI *** Stack at address 0002B3B0 Static variables at address 00020598 J (A/0070/0002B420) = 6 ANZCALL (S/0008/000205A0) = 10 **** PROCEDURE 'FIBONACCI' WAS CALLED BY --> 'FIBONACCI' FROM LINE: 37 EPA address of FIBONACCI is 000205A8 Call offset is 0098 **** VARIABLES FOR 'FIBONACCI *** Stack at address 0002B338 Static variables at address 00020598 J (A/0070/0002B3A8) = 7 ANZCALL (S/0008/000205A0) = 10 **** PROCEDURE 'FIBONACCI' WAS CALLED BY --> 'FIBONACCI' FROM LINE: 37 EPA address of FIBONACCI is 000205A8 Call offset is 0098 **** VARIABLES FOR 'FIBONACCI *** Stack at address 0002B2C0 Static variables at address 00020598 J (A/0070/0002B330) = 8 ANZCALL (S/0008/000205A0) = 10 **** PROCEDURE 'FIBONACCI' WAS CALLED BY --> 'FIBONACCI' FROM LINE: 37 EPA address of FIBONACCI is 000205A8 Call offset is 0098 **** VARIABLES FOR 'FIBONACCI *** Stack at address 0002B248 Static variables at address 00020598 J (A/0070/0002B2B8) = 9 ANZCALL (S/0008/000205A0) = 10 **** PROCEDURE 'FIBONACCI' WAS CALLED BY --> 'FIBONACCI' FROM LINE: 37 EPA address of FIBONACCI is 000205A8 Call offset is 0098 **** VARIABLES FOR 'FIBONACCI *** Stack at address 0002B1D0 Static variables at address 00020598 J (A/0070/0002B240) = 10 ANZCALL (S/0008/000205A0) = 10 **** PROCEDURE 'FIBONACCI' WAS CALLED BY --> '$PASMAIN' FROM LINE: 46 EPA address of FIBONACCI is 000205A8 EPA address of $PASMAIN is 000206D8 Call offset is 0108 **** VARIABLES FOR '$PASMAIN *** Stack at address 0002B068 Static variables at address 00020580 I (A/0160/0002B1C8) = 10 TIME (A/0164/0002B1CC) = 13 TESTDUMP (S/0008/00020588) = 42 TESTCHAR (S/000C/0002058C) = 'Oppolzer ' **** END OF SNAPSHOT DUMP ****

Here you have the sourcecode of the 2016 version of FIBDEMO.PAS:


program FIB_DEMO ( OUTPUT ) ; (********) (*$A+ *) (********) type POS_INT = 0 .. 30 ; var I : POS_INT ; TIME : INTEGER ; static TESTDUMP : INTEGER ; TESTCHAR : array [ 1 .. 10 ] of CHAR ; function FIBONACCI ( J : POS_INT ) : INTEGER ; (******************************) (* to evaluate fibonacci # j, *) (* for j >= 0 *) (* subject to int overflow *) (******************************) static ANZCALL : INTEGER ; begin (* FIBONACCI *) ANZCALL := ANZCALL + 1 ; if J = 0 then FIBONACCI := 0 else if J = 1 then FIBONACCI := 1 else FIBONACCI := FIBONACCI ( J - 1 ) + FIBONACCI ( J - 3 ) ; end (* FIBONACCI *) ; begin (* HAUPTPROGRAMM *) TESTDUMP := 42 ; TESTCHAR := 'Oppolzer' ; for I := 10 to 25 do begin TIME := CLOCK ( 0 ) ; WRITELN ( ' fibonacci # ' , I : 3 , ' is ' , FIBONACCI ( I ) : 8 , ' (Comp.time = ' , CLOCK ( 0 ) - TIME : 5 , ' Milli Sec.)' ) ; end (* for *) end (* HAUPTPROGRAMM *) .

Back to Compiler main page