I'm trying to find a 70s or very early 80s source code of a Pascal pretty-printing program which is more advanced than the version mentioned on the Prettyprint wiki page which is undated and somewhat COBOL-like with procedures having definitions like
PROCEDURE GETCHAR( (* FROM *) VAR INPUTFILE : TEXT;
(* UPDATING *) VAR NEXTCHAR : CHARINFO;
(* RETURNING *) VAR CURRCHAR : CHARINFO );
For some reason I cannot compile it with online Free Pascal - apart form some unclear issue with the IN
operator, the contemporary language does not support the intrinsic function GET
(other Pascal compilers available online use Free Pascal as well, failing in similar ways).
With a few modifications, however, that pretty-printer compiles and works on the BESM-6 emulator, but the results are unsatisfactory, e.g. it sometimes inserts spaces between periods in array declarations, seemingly haphazardly:
type alfa = packed array [1..6] of char;x=array[1..2] of integer;
alfa2 = packed array [1..12] of char;
alfa22 = packed array [1..2] of alfa2;
becomes
TYPE ALFA = PACKED ARRAY [ 1 . . 6 ] OF CHAR ;
X = ARRAY[1..2] OF INTEGER;
ALFA2 = PACKED ARRAY [ 1 . . 12 ] OF CHAR ;
ALFA22 = PACKED ARRAY [ 1 . . 2 ] OF ALFA2 ;
Is there the source code of a better legacy Pascal pretty-printer?
Rationale:
I've decompiled the BESM-6 Pascal pretty-printer which performs some syntax checking and parses a few pseudo-comments, including one which is not understood by the BESM-6 Pascal compiler proper: specifically, Jx where x is a character which is taken literally to be the (optional) meta-character for the language keywords from now on.
Apart from recognizing the keywords and calling procedures handling the corresponding statements, most of the logic is not understood, and the variable names and procedures are non-mnemonic.
(Caveat lector: for reading convenience, begin/end are represented with { }, and the comments are bounded with (* and *); also, the code contains machine-specific details pertaining to the output file format with word-aligned lines of fixed width and compressed spaces.)
To facilitate restoring the source code closer to its original form, it would be nice to find a prototype of this program (which likely exists as there was no point adding support for non-existent pseudo-comment characters if the pretty-printer was written from scratch).
The programming manual mentions that the program was transferred to the Computing Center of the USSR Academy of Sciences by scientists from the GDR. That makes it even more likely that the program had a Western prototype.