Pascal-S is a subset of Pascal selected for introductory programming courses. The implementation is especially designed to provide comprehensive and transparant error diagnostics and economical service for small jobs.
The system consists of a compiler and an interpreter and is defined as a single, self-contained Pascal program.
Pascal-S is written in Pascal, and forms an excellent introduction to the art of designing small compilers.
Ben-Ari built on Pascal-S in the first version of his “Principles of concurrent programming” and introduced concurrency, see the Pascal-S Copascal page.
It is a interesting to see how many CDC-Pascal specialities are built into this compiler/interpreter.
- Keywords are recognized by a binary search through a list of alfa’s (a standard datatype in CDC-Pascal) which are a 60-bit machine word packed with 10 6-bit characters. Since both DO and DOWNTO are keywords it is apparent from the ordering of the list that space comes after letters in the CDC character set <.li>
- Some of the handling of large integers will only succeed on a CDC pascal implementation programs data gave the desired results
- In Simpleexpression a 36 is emitted to negate both reals and integers, but the interpreter does this for both reals and integers s(.t.).i := – s(.t.).i;
On the CDC this actually works for reals too
Corrections to the original (Jan van de Snepscheut):
- line 295 (counting from 1 starting at program Pascal-S) is
gen1(mulc, ttab[t].size); gen0(add)
whereas the version printed in the book accidentally reads
gen1(mulc, ttab[t].size)
the corrected versions also implements boolean negation - the procedure funcdeclaration in the version printed in the book is
erroneous. The first line on page 376 in the book should read
if lev>1 then dx:=-1
the last line of the procedure should read
gen1(exit,itab[f].resultadr-dx); lev:=lev-1; dx:=odx
Wirth’s original paper is reprinted in Barrons book. Another version of Pascal-S appears in Snepscheut’s book and this uses symbolic names and contains a small peephole optimizer.
Publications where Pascal-S appeared in source format are:
- PASCAL-S: A Subset and its Implementation, by Niklaus Wirth, Zurich : Eidgenossische Technische Hochschule, 1975. 61 s., Berichte des Instituts fur Informatik;
- Pascal – The Language and its Implementation, by D. W. Barron, Chichester :
John Wiley and Sons, 1980. 201 s. , ill., Wiley Series in Computing - Principles of Concurrent Programming, by M. Ben-Ari, Englewood Cliffs, N.J. :
Prentice-Hall, Inc., 1982, 172 s. , ill. - What Computing is All About, by Jan L. A. van de Snepscheut
Downloads:
- PASCAL-S A subset and its Implementation, Niklaus Wirth, June 1975
- PASCAL-S A subset and its Implementation, Niklaus Wirth, June 1975 text format
- Pascal-S source, Niklaus Wirth, as published in 1975.
- Pascal-S source by Jan vd Snepscheut with corrections and more readable
- Pascal-S source Snepscheut Johnstone for Turbo Pascal
- Pascal-S source Nielsen Turbo Pascal 4
- Pascal-S source for Turbo Pascal
- Pascal-S source for Turbo Pascal 5.5
- Pascal-S source Ansi Pascal standard, Scott Moore
- Pascal-S source ISO7185 standard, Scott Moore
- Pascal-S programs
Some information on this page has been published by Scott Moore on the Standard Pascal pages and by Birger Nielsen (pages now lost).