Unexplainable compilation errors

Post Reply

Topic author
willemgrooters
Valued Contributor
Posts: 73
Joined: Fri Jul 12, 2019 1:59 pm
Reputation: 0
Location: Netherlands
Status: Offline
Contact:

Unexplainable compilation errors

Post by willemgrooters » Fri Jan 21, 2022 3:12 pm

$ pascal/ver
VSI Pascal Alpha V6.2-125 on OpenVMS Alpha V8.4-2L1
$

Two almost equal files: the only difference is input selection criteria and display of relevant data; the basic structure is:

Code: Select all

[inherit ('Starlet','pascal$lib_routines',
         'CMSPEN:WGCMS_CONSTANTS',
         'CMSPEN:WGCMS_TYPES',
         'CMSPEN:WGCMSPOST_INTERFACE',
         'CMSPEN:WGCMSPOST_RMS',
         'CMSPEN:WGCMS_ROUTINES')]
program testReadByDate (INPUT,OUTPUT);

...
Procedure ShowPost;
var
    _Date: integer;
    _Seq: integer;
    _Out: text;

begin
    OPEN( FILE_VARIABLE :=_OUT,
          FILE_NAME := 'SYS$OUTPUT:',
         CARRIAGE_CONTROL := NONE,RECORD_LENGTH := 8192 );

    rewrite (_OUT);

    _Date := _PostMeta^.DatNr div 100;
    _Seq := _PostMeta^.Datnr rem 100;                                                             { line 46 }

    WRITELN(_OUT, ''(LF)'=================='(CR)'');
    { Show selection and post^ data }
    WRITELN(_OUT, ''(LF)'text=' + _Text+''(CR)'' );
    close (_OUT);
end;

begin
    WRITE ('Enter publication date: ');    { or Number }      { line 64 }
    READLN (_D)  ;

   {Get the data into _Post^}
   
    if _Post <> nil then
    begin
        ShowPost;
    end else
        WRITELN( ''(LF)'Could not read post ' +''(CR)'' );
...
    repeat
        WRITELN (''(LF)'============================================='(CR)'');
        WRITE ('Prev/Next/Stop (P|N|S, -|+|. ');                                                             { line 85} 
        READLN (_R)  ;
        { Process input: get next or previous record and display data}
..
    until (_r[1] ="S") or (_r[1] = '.') ;

...
end.
Both files did compile correctly, but after moving some files between inherited sources (moved constants and types) both fail on the following errors:

Code: Select all

    _Seq := _PostMeta^.Datnr rem 100;
.............................^
%PASCAL-E-SYNSEMMODI, Syntax: ";", "::" , "^", "." or "[" expected
at line number 46 in file WGCMS_ROOT:[SRC]testReadByDate.pas;58

    WRITE ('Enter publication date (format yyyymmdd): ');
....^
%PASCAL-E-NOTAVAR, WRITE is not declared as a variable
at line number 64 in file WGCMS_ROOT:[SRC]testReadByDate.pas;58

    WRITE ('Enter publication date (format yyyymmdd): ');
..........^
%PASCAL-E-SYNASSIGN, Syntax: ":=" expected
at line number 64 in file WGCMS_ROOT:[SRC]testReadByDate.pas;58

        WRITE ('Prev/Next/Stop (P|N|S, -|+|. ');
........^
%PASCAL-E-NOTAVAR, WRITE is not declared as a variable
at line number 85 in file WGCMS_ROOT:[SRC]testReadByDate.pas;58

        WRITE ('Prev/Next/Stop (P|N|S, -|+|. ');
..............^
%PASCAL-E-SYNASSIGN, Syntax: ":=" expected
at line number 85 in file WGCMS_ROOT:[SRC]testReadByDate.pas;58
%PASCAL-E-ENDDIAGS, PASCAL completed with 5 diagnostics
Last edited by willemgrooters on Fri Jan 21, 2022 3:31 pm, edited 1 time in total.

User avatar

arne_v
Valued Contributor
Posts: 67
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: Unexplainable compilation errors

Post by arne_v » Fri Jan 21, 2022 6:54 pm

rem ?

I believe Pascal use mod not rem.

Added in 1 minute 49 seconds:
The errors on write more sound like the compiler got off track before the line with write.
Arne
arne@vajhoej.dk
VMS user since 1986


mw
Member
Posts: 7
Joined: Mon Jul 06, 2020 4:38 am
Reputation: 0
Status: Offline

Re: Unexplainable compilation errors

Post by mw » Sat Jan 22, 2022 9:21 am

VSI Pascal for OpenVMS Reference Manual, Table B.1 has the VSI Pascal extensions, it lists REM.

The (inherited) sources changed. I would look at the diffs. I would expect a variable REM being declared somewhere.

Code: Select all

$ ty x.pas
program x;
var i,j,rem:integer;
begin
j:=17;
i:=j rem 5;
end.
$ pas x

i:=j rem 5;
.....^
%PASCAL-E-SYNSEMMODI, Syntax: ";", "::" , "^", "." or "[" expected
at line number 5 in file DSA3:[DECUSERVE_USER]X.PAS;9
%PASCAL-E-ENDDIAGS, PASCAL completed with 1 diagnostic
$ 
Last edited by mw on Sat Jan 22, 2022 12:44 pm, edited 1 time in total.

User avatar

arne_v
Valued Contributor
Posts: 67
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: Unexplainable compilation errors

Post by arne_v » Sat Jan 22, 2022 6:48 pm

Ah. Indeed it is.

And it belongs to "redefinable reserved words" and to quote docs:
Table 1–4 presents the redefinable reserved words that are used to name
operators and identifiers. You can redeclare these words, but, if you do, the
language feature becomes unavailable within the block in which you redeclare
the word.
Last edited by arne_v on Sat Jan 22, 2022 6:48 pm, edited 1 time in total.
Arne
arne@vajhoej.dk
VMS user since 1986

Post Reply