Skip to content

Shell script wrapper around the Regina Rexx interpreter that traps and prints syntax and other errors

License

Notifications You must be signed in to change notification settings

ajborla/regina-syntax-checker

Repository files navigation

regina-synchk

Simple Regina Rexx script syntax checker

author: Anthony J. Borla
contact: [email protected]
license: MIT

Overview

The Rexx programming language dates back to 1979, making it one of the first scripting languages. It is still used on various platforms, although primarily on IBM mainframes.

Regina Rexx is an actively developed, and popular Rexx implementation targeting non-mainframe platforms, including both Windows and Linux.

The current project comprises a Bash script, regina-synchk, which acts as a wrapper around the Regina Rexx executable. It is used in place of the executable to run a Rexx script for syntax checking purposes.

A successful syntax check would see no output emitted, with a zero exit status, whilst a failed syntax check would see number-lined script source code emitted, together with a standardized message highlighting the error and its source, together with a non-zero exit status.

It is anticipated that such syntax checking could prove useful as part of Rexx script testing regimes.

Installation

No formal installation process is required.

A single file, regina-synchk, needs to be copied from the current repository to a target directory on the execution path. This would usually be, /usr/local/bin, if system-wide access is required.

The script has been tested using Regina versions 3.9.5 and 3.9.6, and tested on CentOS 7, Ubuntu 20.04 and 22.04, and on Windows using Git for Windows.

Usage

Once installed, invoke script as follows:

regina-synchk

The following will be emitted:

Usage: regina-synchk <Rexx file>

indicating that a Rexx script name is expected.

If the sample Rexx scripts have been copied to the current directory, try invoking using:

regina-synchk error-sample-no-error

No output will be emitted, and a zero exit status returned, indicating the nominated script has passed the syntax check.

Invoking:

regina-synchk error-sample-bad-arithmetic

should result in an exit status of 1 returned, and the following output emitted:

     1  call NeedsAnArgument
     2  exit 0
     3  NeedsAnArgument : procedure
     4    b = 1 + a
     5    nop
     6  return c

Bad arithmetic conversion on LINE: 4 -> b = 1 + a

The error type and location within the nominated script file should be evident.

Acknowledgements

Kudos to Mark Hessling for the tremendous effort in having maintained Regina Rexx for so many years.

TODO

  • Revise script, to remove dependence on external utilities like grep and sed, replacing with in-built bash facilities
  • Replace script with an equivalent Rexx script
  • Add more example-error-*.rexx test scripts
  • Add a test-regina-synchk script

About

Shell script wrapper around the Regina Rexx interpreter that traps and prints syntax and other errors

Resources

License

Stars

Watchers

Forks

Releases

No releases published