Oppolzer - Informatik / Stanford Pascal Compiler


Home       Lebenslauf       Schwerpunkte       Kenntnisse       Seminare       Kunden       Projekte       Produkte       Blog       Stanford Pascal       Kontakt

The Stanford Pascal Compiler

Last changes: 2017-10-04

Breaking News

New compiler release 10.2017 available for MVS (TK4), VM/CMS, Windows and OS/2
PCINT executables for Windows and OS/2 are ready for version 10.2017

The new compiler release uses an external symbol scanner called PASSCAN
for the first time; more details see below. Because this involved many changes
to the compiler, the old version is distributed, too (just in case ...)

The Story

I am currently the maintainer of an improved version of the Stanford Pascal compiler.

It runs on VM/370 Rel.6 and on MVS 3.8j on the Hercules emulator.
And it runs on today's z/OS, too (tested first by Rene Jansen in 05.2017, thanks!).
It will sure run on modern zVM, too (at the moment limited to AMODE 24, RMODE 24).
The VM and MVS versions can be downloaded from this site (including source codes), see "Resources" below.

It also runs (tested) on Windows, OS/2, Linux (x86) and Mac OS.
On these platforms the P-Code generated by the first compiler pass is interpreted by a P-Code interpreter written in ANSI-C,
so it will probably run on every platform that has a C compiler. Please contact me, if you want to test it on other platforms.
The Windows (and OS/2) version is available from this site, too; see "Resources" below.

This page tells the story, how I started working on this compiler (in 2011), what I did so far, and what I will do next (if I get the spare time to do it).

You can follow the development process more closely on this Facebook page:
Stanford Pascal on Facebook

Evolution steps so far (will be continued ...)

My own Pascal history (please forgive me, this is in German)
Porting the Stanford compiler from MUSIC/SP to VM on Hercules
First extensions to the compiler in 2011
New keywords BREAK, CONTINUE, RETURN - still in 2011
Extensions to the runtime system (PASMONN) in 2016
Making RESET and REWRITE optional and eliminating the implicit RESET on INPUT
Allow shorter string constants on const initializers and assignments
20 significant characters on variable names (not only 12)
SNAPSHOT Routine
Shorter string constants - continued
Dynamic Storage Management
Pointer arithmetic - new functions ADDR, PTRADD, PTRDIFF, SIZEOF, PTR2INT
Pascal library
Storage management - new functions ALLOC, FREE, ALLOCX, FREEX
Static definitions
Extending PASSNAP aka SNAPSHOT
New functions MEMSET and MEMCPY
Direct WRITE of scalar variables or expressions
Maximum length of string constants is now 254 (was 64)
Making CSP numbers consistent between PASCAL1, PASCAL2 and PASMONN
Call CMS commands from PASCAL programs
PASSNAP prints variables from more than one source file
PASSNAP prints heap variables allocated by NEW and ALLOC
Porting Stanford Pascal to Windows, OS/2 and Linux - first steps
Porting Stanford Pascal to Windows, OS/2 and Linux - other issues
Improving PASSNAP for the NODEBUG case
Porting Stanford Pascal to Windows, OS/2 and Linux - portable branch tables
Porting Stanford Pascal to Windows, OS/2 and Linux - success !!
Bit operations
Support undeclared procedures
Some Pascal/VS features added (DATETIME, HALT, CLOSE, TERMIN/TERMOUT)
Differences on floating point computations and rounding
Differences on floating point output
MVS version
Job control examples for the MVS compiler
Changes for the MVS compiler
Changes to PASSNAP and PASSNAPC - better error handling in PASMONN
New standard type ANYFILE - VOIDPTR renamed to ANYPTR
MVS version available for download
Stanford Pascal works on MacOS and on (modern) z/OS
Terminal flag in the Pascal FCB - effects on I/O functions
Integer and character constants in hex and binary representation
Improvement on Pascal sets - Part one
String constants built from several mixed parts (hex or binary)
SIZEOF usable on string constants
New source program scanner (PASSCAN) - separate module
C++ style comments
Binary integer constants
Write integer with leading zeroes, if desired (controlled by negative width)
Compiler messages shown at terminal (aka SYSPRINT) during compile

All on one page

Resources (Compiler Version 10.2017)

Warning: no warranty at all for the software contained here; I don't recommend that you use it for any production work. The AWS Tape file may contain an older version, which is not as current as the development stories from above. The source codes will be more current, but maybe you will not be able to compile them using the older versions on the AWS Tape, because it is sometimes necessary to apply incompatible extensions to the compiler. If I have time, I will put the new version to the AWS Tape, too (if the new version is stable enough).

If you have difficulties running or compiling the actual versions, contact me directly. I will help you as soon as I can, and I would like it if you test this compiler using some Pascal sources you maybe have.

The source code of the first pass: PASCAL1.PAS
The source code of the second pass: PASCAL2.PAS
The symbol scanner module: PASSCAN.PAS
Backup version 09.2017 first pass: PASCAL1A.PAS
Backup version 09.2017 second pass: PASCAL2A.PAS
To start Pascal programs using VM/CMS: XRUNPARM.ASS
The Pascal monitor and runtime: PASMONN.ASS
The source code of the LIBX library routines: PASLIBX.PAS
The source code of the UTILS library routines: PASUTILS.PAS

The source code of the MVS snapshot routine: PASSNAP.PAS
The source code of the CMS snapshot routine: PASSNAPC.PAS

The source code of the PASFORM source formatter utility: PASFORM.PAS
The source code of the XCOMP compare utility: XCOMP.PAS

Pascal Compiler for CMS (version of 10.2017)

AWSTape File to TAPE LOAD the Pascal system to CMS

Pascal Compiler for MVS (version of 10.2017)

ZIP File containing the Pascal system for MVS - or z/OS

Usage Notes for the MVS version:

1) the ZIP file contains subdirectories which are named like MVS datasets; you should transfer the files contained in the subdirectories to such PDS libraries (omit the file extensions). You may choose another high level qualifier than PASCALN. Most files are text files (text FTP would be OK), but the files contained in the directories with last name part = TEXT are RECFM fixed LRECL 80 object files (binary FTP required).

2) to build load libraries for the compiler and the runtime, start the job INSTALL from PASCALN.COMPILER.CNTL (returncode 8 from some steps is OK, but the final two steps should return zero). You may have to customize the INSTALL job if you have chosen another HLQ than PASCALN.

3) copy the members PASNC, PASNCL, PASNCG and PASNCLG from PASCALN.COMPILER.PROCLIB to SYS2.PROCLIB (on Hercules); on another z/OS system: make sure that those JCL procedures are known to your system

4) To start the compiler, look at the example jobs in the CNTL datasets; they use the JCL procs PASNC, PASNCL, PASNCG and PASNCLG mentioned above

There is also a file PASCALN.TXT, which contains all the stuff in one file, created on the mainframe using the Pascal program DOWNLOAD.PAS (included in the ZIP file, too); the PC files in the directories with the MVS like names are created using the Pascal program SPLITPAS.PAS on Windows (which is also included in the ZIP file). Instead of transferring individual members to your target system, you could also try to transfer this file to the target system and do the unpacking there (maybe with a REXX script).

Pascal Compiler for Windows and OS/2 (version of 10.2017)

ZIP File containing the Windows (and OS/2) version of the compiler (STPascW.ZIP)

Usage Notes for the Windows and OS/2 version:

Unzip the ZIP file to a directory of your choice.
The EXE files are removed and the CMD files are renamed to *.CMD_TXT to make virus checkers happy.
To compile PCINT, use the file AW.CMD and a C-Compiler of your choice - for example WATCOM C.
On OS/2: I used the IBM C-Compiler to compile PCINT etc.; see AW.CMD to get the idea how to do it. Every other C-Compiler will also do the job.
Precompiled executables of PCINT are available below; PCINT.EXE for Windows and PCINT2.EXE for OS/2.

PP <program> to call the Pascal compiler; the program should be stored in a file <program>.PAS
PRUN <program> to run the program
set DD_<logical_filename>=<physical_filename_including_path> to assign files

P-Code interpreter (PCINT.EXE) for Windows

P-Code interpreter (PCINT2.EXE) for OS/2

Pascal Compiler for Linux, MacOS and other systems

please contact me directly

Documentation

The Programming Language Pascal (Niklaus Wirth, 1972)
Stanford Pascal/360 Implementation Guide (1974)
P-Code Description (1978)
The Stanford Pascal compiler (1979)
The Implementation of Case Statements in Pascal (1981)
Pascal/VS Language Reference Manual (1981)
The Pascal ISO 7185 Standard (1991)
LE Stack and Heap Implementation (IBM 2005)
P-Code Description (2016) - work in progress

Back to main page