Pascal-U

The Computer Science department of the Vrije Universiteit in Amsterdam is where I learned to program.
In Pascal as was usual in those years. Here my interest in compiler writing started, since there was a lot of interest in that subject there.
Two educators there taught me about programming: Professor R.P. van de Riet, and, the then young and later so famous, Professor Andrew S. Tanenbaum.

The first VU Pascal compiler was Pascal-U, initiated by van de Riet, based of course on Wirth’s portable Pascal-P2 compiler/interpreter.

Once this compiler was operational on a Unix PDP-11/45, a Pascal interpreter system was developed called BASIS, to help a student do practical programing work.

Pascal-U July 1977 can be found in a folder called ‘vrije’ on the tape dump at https://www.tuhs.org/Archive/Applications/Usenix_77/ug091377.tar.gz

Header of the Pascal compiler

(*version: 004      date: 1-5-77*)
(*--------------------------------------------------------------
|                                                               |
|       P A S C A L   C O M P I L E R                           |
|       -----------------------------                           |
|                                                               |
|   This compiler processes PASCAL-U1, a subset of              |
|   of standard PASCAL and has been written in this subset.     |
|   It is a modified version of the PASCAL-P2 compiler as       |
|   distributed by the ETH at Zuerich.                          |
|                                                               |
|   Authors:                                                    |
|      Urs Amann, Kesav Nori, Christian Jacobi                  |
|                                                               |
|   Authors of modification:                                    |
|      Rudolf van Bottenburg, Johan Stevenson                   |
|       Vakgroep Informatica                                    |
|       Wiskundig Seminarium                                    |
|       Vrije Universiteit                                      |
|       A M S T E R D A M                                       |
|                                                               |
---------------------------------------------------------------*)

Downloads

Source of Pascal-U compiler
User manual of the Pascal-U compiler
Archive of Pascal-U compiler
Source and man pages and binaries for Unix System 6

Note that the archive contains the source of the compiler, but not of the interpreter.

First part of the Pascal-U manual

PASCAL‐U is the name of the dialect of Pascal implemented on the PDP 11/45 under
the UNIX time‐sharing system.  This dialect is based on PASCAL‐P as  distributed
by  the ETH at Zurich.  The implementation of PASCAL‐U has been developed by the
vakgroep informatica of the  Vrije  Universiteit,  Amsterdam,  The  Netherlands.

                                 2.Some history
                                 ‐‐‐‐‐‐‐‐‐‐‐‐‐‐
The  first  plans  to implement Pascal on the PDP 11/45 were developed under the
guidance of prof. R.P.van de Riet. In those days (mid 1975) the operating system
was  DOS,  a  single user system.  The greatest problem has been the limited ad‐
dress space of the machine.  The Pcompiler produces code for a virtual  machine,
called  the  SC  machine.  Macro expansion of SC instructions to PDP‐11 code was
not feasible due to the addressing limit of the PDP‐11.  Therefore  the  SC  in‐
structions were directly encoded and an interpreter was written to execute them.
The following description concerns work carried out by Rob Thomas, Johan Steven‐
son and later on by Rudolf van Bottenburg.  The first bootstrap used a CDC Cyber
73 computer on which Pascal was available.

At the end of 1975 a preliminary version was running under  DOS.   Many  changes
have  been  made to the PASCAL‐P2 compiler, most of them forced by the different
size for variables of the various standard  types  and  the  address  alignment.
(The  Pcompiler foolishly assumed that integers,reals etc. all occupied the same
number of storage units.)  At the same time, however, the UNIX time‐sharing sys‐
tem  was  installed. That required adjusting the Pascal system.  The interpreter
was rewritten in the UNIX assembly language, and the SC assembler  in  the  high
level language C.

To  minimize  the  space  requirements, some changes were made to the first UNIX
version:
a.based upon static counting of SC‐instructions in the compiler itself, some in‐
  structions of 2 or more bytes with a high frequency got a 1‐byte format.  This
  is not done very systematically, however. Further measurements are needed.
b.a lot of optimization is done concerning label references: offsets instead  of
  indices, distinction between forward and backward, long and short offsets.
c.the handling of input and output is improved.
This  resulted in a 25% saving in space for code, while at the same time the in‐
terpretation speed improved.  The 16000 SC‐instructions for the compiler  itself
are  coded in less than 26000 bytes, inclusive constants.  This system is called
the PASCAL‐U1 system.

One of the projects under development in our department, is the BASIS system. It
is  used  in teaching basic programming techniques to students of several disci‐
plines. BASIS is a big program written in Pascal, in size  comparable  with  the
Pcompiler.  One  of  the  reasons to make Pascal available on the PDP 11/45, has
been this BASIS project.

The plans for the near future are:
a.to adopt the improvements of the P4‐compiler with respect to the P2‐compiler.
b.to allow external procedures.
c.to allow the Pascal user to choose between interpretation and execution of ex‐
  panded  SC‐instructions.  For example, one would like to make the scanner of a
  compiler fast by execution of its expanded code and leave the other parts  in‐
  terpreted,  since for most programs 20% of the program is responsible for more
  than 80% of its execution time.
d.to make some local improvements touched upon in the assembler description.
e.to tune the instruction set of the abstract machine.

    

MAN page for the PASCAL-U compiler



PC(I)                       03/05/77                        PC(I)


NAME
       pc ‐ PASCAL‐U compiler

SYNOPSIS
       pc [‐lpc12rx] file.p [arg1 ...]

DESCRIPTION
       pc  is  the  UNIX pascal compiler. It has an optional flag
       argument.
       If  no  flags are given, pc compiles the program on file.p
       and leaves the bsc‐code on file.b. Diagnostics are written
       to  standard  output.   The effect of the flags is as fol‐
       lows:

       ‐l   produces a complete listing of the program with error
          indications and explained error messages.

       ‐p  makes a partial listing. Only the erroneous lines  are
          listed.

       ‐c  suppresses code generation, does a syntax and semantic
          check only.

       ‐1 performs pass1 of the compiler, leaves the intermediate
          (sc) code on file.i .Pass2 is suppressed, unless the ‐2
          flag is given.

       ‐2 executes pass2 of the compiler and leaves interpretable
          bsc‐code  on  file.b.   If given without the ‐1 flag it
          expects its input on file.i rather than file.p.

       ‐r  runs  the  compiled program by calling the interpreter
          with file.b as codefile.  Arguments given after  file.p
          are passed.

       ‐x invokes sc‐code expansion.(not yet implemented)

       After  an error is detected during pass1, the code generation
       is suppressed.

       The main differences from standard PASCAL are:
       1. The  program has no other file than those in  the  pro‐
          gram heading, which have type text.There may be at most
          eight files, including the predeclared files input  and
          output,  which  are  associated with standard input and
          output.

       2. Formal  parameters must not be functions or procedures.

       3. All  records are packed. The procedure  unpack  is  not
          available.

       4. The  maximum length of string constants is 80.

       5. The  ordinal value of a set element  must lie between 0

                              ‐ 1 ‐


PC(I)                       03/05/77                        PC(I)


          and 63 inclusive.

       6. A  goto  may  not lead out of a  procedure  or function
          body.

       7. After  reset a call of  get is  necessary to initialize
          the buffer of a non‐standard inputfile.

       8. The procedure dispose is not available.  Mark  and  re‐
lease             are  added  to  manipulate  the  heap:
mark(anyptr)          puts the top of  heap  address  in  anyptr.
            release(anyptr)     restore  the  top  of  heap  from
anyptr.


FILES
       file.p  source file
       file.i  intermediate sc‐code
       file.b  bsc‐code, interpretable by pi.
       /lib/ppass1 pass1
       /lib/ppass2 pass2
       /lib/pclist error diagnostics
       /usr/bin/pi interpreter

SEE ALSO
       pi (I), PASCAL‐U1 documentation, PASCAL user manual.

DIAGNOSTICS
       The  diagnostics  are  intended  to  be  self‐explanatory.
       "Memory Fault" may be given if space is exhausted.

BUGS
       Reals can only be written  in  E‐format.   Runtime  checks
       are   not  implemented.   Omitting the filename in read or
       write may give problems.  Empty fields in records and empty  
       statements  can give messages.  Writeln and readln require 
       always a parameterlist .

                              ‐ 2 ‐
    

MAN page for the PASCAL-U interpreter

PI(I)                                                    12/22/76


NAME
       pi   ‐   the PASCAL‐U interpreter


SYNOPSIS
       pi    bscfile   userfile1 ....


DESCRIPTION
       The  binary  stack computer code (BSC) is read  from  bsc‐file.  The
       userfiles  are expected to be the actual  file  parameters to  be
       substituted for the formal file names given in the  pascal program
       heading.   Standard  output and standard input are substituted  for
       the formal names output and input.  The order of the arguments is
       assumed to correspond with the order of the remaining formal file
       names.


SEE ALSO
       pc(I), PASCAL‐U1 documentation, Pascal user manual


DIAGNOSTICS


       All error messages are self explanatory.  A  memory  fault 
       can also indicate: no room left