Issues with the Pascal parsing

Here you can discuss the universal Integrated Development Environment for OpenVMS.
Post Reply

Topic author
brianreiter
Active Contributor
Posts: 26
Joined: Fri Jun 14, 2019 4:17 pm
Reputation: 0
Status: Offline

Issues with the Pascal parsing

Post by brianreiter » Fri Nov 29, 2019 4:42 am

OK, good news is that things work better on Windows 10 running on a faster laptop with more memory.

The are some issues:

Functions and variables with a "$" a flagged with a token recognition error.

This is problematic with RTL and system service calls.

Pascal builtins such as %ROUTINE are flagged with a token recognition error.

We use these as part of the diagnostic processing

Embedded form feeds in the source are flagged with a token recognition error.

Not a huge issue, these will get removed over time.

Variants on the Case statement such as:

Code: Select all

    CASE out_of_band.control_char OF
        SMG$K_TRM_CTRLC,
        SMG$K_TRM_CTRLY,
        SMG$K_TRM_CTRLZ : $SETEF (abort_ef);

        SMG$K_TRM_CTRLW : return_status := SMG$repaint_screen (out_of_band.paste_id);
    END;
are flagged with a missing ":" error on the first line.

Mismatch ELSE expecting ; reported for:

Code: Select all

    IF ODD (return_status) THEN
    BEGIN
        { ---------------------- }
        { Process the key input. }
        { ---------------------- }

        CASE key_pressed OF

            SMG$K_TRM_PF4 : finished := TRUE;
        END;
    END
    ELSE
    BEGIN
        { ----------------------------- }
        { Failed to read the keystroke. }
        { ----------------------------- }

        IF (return_status <> SS$_TIMEOUT) THEN $EXIT (return_status);
    END;
Getting mismatched input, 'return_status' expecting {FUNCTION, PROCEDURE} for

Code: Select all

  Return_status := SMG$draw_line (column_headings_id, 2, 1, 2, 132, SMG$M_BOLD, );
Are the aligned directives supported?. Getting mismatched input '0' for

Code: Select all

    CENTRE_MAP_ELEC_TYPE         = RECORD
				       dev_elec_id       : [ALIGNED(0)] DEV_ELECTRONIC_ADD_TYPE;
				       picture_id        : [ALIGNED(0)] PICTURE_ID_TYPE;
				       subsystem_code    : [ALIGNED(0)] SUBSYSTEM_CODE_RANGE
				   END { CENTRE_MAP_ELEC_TYPE };
Has issues with variable initialisation, get mismatched input ':=' expecting ;

Code: Select all

FUNCTION initialise : INTEGER ;

VAR
    return_status	: INTEGER := SS$_NORMAL ;
    temp_iosb		: IOSB := ZERO ;
Issues with defaulting parameters to function calls.

Get more mismatched input on things such as:

Code: Select all

       report_diagnostics(      return_status,
                                 ,
                                 ,
                                 %ROUTINE,
                                 'Finish startup returned an error status')
And this:

Code: Select all

		    WRITELN ( 	oplog_file , PAD ( '' , ' ' , 41) ,
				SUBSTR ( reported_text[line_count],1,TRIMMED_LENGTH (reported_text[line_count]) ) 
				, ERROR := CONTINUE ) ;
VARYING keyword seemingly not handled

Code: Select all

   date_stamp		: VARYING [10] OF CHAR ;
Get mismatched input errors for the "10" and the "OF".



I suspect a lot of these are down to the differences between VMS Pascal and standard Pascal.

Hope this helps.

cheers

Brian
Last edited by brianreiter on Fri Nov 29, 2019 5:26 am, edited 1 time in total.


sergey_vorfolomeev
VSI Expert
Valued Contributor
Posts: 98
Joined: Thu Aug 22, 2019 12:17 am
Reputation: 0
Status: Offline

Re: Issues with the Pascal parsing

Post by sergey_vorfolomeev » Fri Nov 29, 2019 5:20 am

Thanks for your feedback. We will try to fix this as soon as possible, but it can take a time.


Topic author
brianreiter
Active Contributor
Posts: 26
Joined: Fri Jun 14, 2019 4:17 pm
Reputation: 0
Status: Offline

Re: Issues with the Pascal parsing

Post by brianreiter » Fri Nov 29, 2019 9:12 am

No problem, I'll post more niggles as I find them.


Topic author
brianreiter
Active Contributor
Posts: 26
Joined: Fri Jun 14, 2019 4:17 pm
Reputation: 0
Status: Offline

Re: Issues with the Pascal parsing

Post by brianreiter » Thu Dec 12, 2019 3:14 am

Looks like many of the parsing errrors have been dealt with in the latest version. One oddity is around using CASE in type definitions.

For example:

Code: Select all

    HIGHWAY_ADDRESS    = RECORD						 { Highway_location_identifier in SIG subsys. }
                             CASE INTEGER OF
                             0:  ( identifier         :[ALIGNED(0)] HIGHWAY_IDENTIFIER;
                                   longitudinal_locn  :[ALIGNED(0)] LONGITUDINAL_LOCATION;
                                   carriageway        :[ALIGNED(0)] CHAR );
                             1:  ( whole              :[ALIGNED(0)] PACKED ARRAY [1..11] OF CHAR );
                             OTHERWISE()
                         END;   { RECORD HIGHWAY_ADDRESS }
Gives the error ""mismatched input 'END' expecting {'+', '-', ',', '(', ')', '[', '(.', '@', P_IMMED, P_REF, P_DESCR, P_STDESCR, P_INCLUDE, P_DICTIONARY, ........"

Its not a huge problem, just one of the vararies of VMS Pascal.


Topic author
brianreiter
Active Contributor
Posts: 26
Joined: Fri Jun 14, 2019 4:17 pm
Reputation: 0
Status: Offline

Re: Issues with the Pascal parsing

Post by brianreiter » Thu Jan 02, 2020 7:43 am

OK, so one other weird bit of formatting for pascal. In some modules we use the [HIDDEN] qualifier before a VAR or CONST block, for example:

Code: Select all


[HIDDEN]
VAR
    status_store        : [VOLATILE] ^status_store_type;        { pointer to data in the global section }
    status_lock         : [VOLATILE] UNSIGNED;
    status_store_end    : [VOLATILE] ^INTEGER;

[HIDDEN] CONST
    status_store_name           = 'STATUS';
    status_lock_name            = '_status';
    status_section_name         = 'NMCS2_SECTION:MIS_STATUS.SEC' ;

At the moment these are getting flagged with the message "no viable alternative at input '[HIDDEN] CONST'". One odd side-effect is that the function definition following the [HIDDEN] definition is flagged with an error ("mismatched input ';' expecting {';', ELSE, END}") on the last of the "END"s. Actually looking at other modules, it is the first "END" after the "[HIDDEN]" keyword is encountered, so this also occurs on a record definition.

cheers

Brian

Added in 2 hours 10 minutes 56 seconds:
One other thing that would be useful would be to display the function/procedure prototypes for the various run time library modules. Effectively the following:

Code: Select all

STARLET
PASCAL$LIB_ROUTINES
PASCAL$STR_ROUTINES 
PASCAL$CLI_ROUTINES 
PASCAL$OTS_ROUTINES 
TCPIP$INETDEF 
Plus a method to provide information for other external libraries (we have CURL and JSON libraries sat in the SYS$LIBRARY path).

Highlighting routines form the various runtime libraries would also be useful.

Added in 17 minutes 19 seconds:
Just spotted yet another issue around using WITH and pointer variables. The construct:

Code: Select all

WITH LAN_varying_array_ptr::LAN_dev_status_dets_ptr_type^ DO
BEGIN
Gives an error of "extraneous input '^' expecting DO". It is perfectly valid Pascal, might be horrible to look at though!


sergey_vorfolomeev
VSI Expert
Valued Contributor
Posts: 98
Joined: Thu Aug 22, 2019 12:17 am
Reputation: 0
Status: Offline

Re: Issues with the Pascal parsing

Post by sergey_vorfolomeev » Fri Jan 17, 2020 6:40 am

Thank you for such a useful review! We will consider implementing your ideas in the next versions.


jfp
Contributor
Posts: 16
Joined: Wed Jun 17, 2020 6:34 am
Reputation: 0
Status: Offline

Re: Issues with the Pascal parsing

Post by jfp » Thu Sep 17, 2020 7:45 am

Hello,

Found also a problem with comment starting with "!" character which is valid under OpenVMS Pascal

Parser return

Code: Select all

token recognition error at: '!'
JF


jfp
Contributor
Posts: 16
Joined: Wed Jun 17, 2020 6:34 am
Reputation: 0
Status: Offline

Re: Issues with the Pascal parsing

Post by jfp » Mon Sep 21, 2020 9:29 am

Also got an error
no viable alternative at input '[byte(4*8+1)] record'
on:

Code: Select all

 modeentry = [byte(4*8+1)] record
JF

Post Reply