Pascal

From EDM2
Revision as of 19:38, 14 September 2019 by Ak120 (Talk | contribs)

Jump to: navigation, search
The Pascal programming language was named after French philosopher and mathematician Blaise Pascal (1623-1662).

Structured procedural language introduced by Niklaus Wirth in 1970 although it had been used internally by ETH as early as 1968, based partially on his earlier ALGOL W language that had been proposed in 1966 to the Algol committee but rejected in favour of the much more complex ALGOL 68. However unlike ALGOL W that was a systems language with a true native code compiler, Pascal was very much intended as a teaching language and therefore simplified and was distributed in as an p-code interpreter that had no system specific features so that programs were fully portable.

Over time there was an increased interest in using the language as a systems language and a number of persons and groups started to extend Pascal in various directions and create native compilers for it, however implementations have a tendency to differ from one another more than with many other languages as the most popular variations of Pascal compilers never adhering to formal standards in anything but name.

History

Development of Pascal was started by Niklaus Wirth at ETH in 1968 with the first public version being shipped in 1970.

Pascal on OS/2

Pascal was heavily used in the development of OS/2 1.x as can be seen by the OS/2 1.x API that follows the Pascal calling convention unlike the OS/2 v2 and later API that follows the C convention. With the initial release of 32 bit OS/2 there were basically two native 32 bit Pascal development systems that were available fairly soon after the introduction of OS/2 2.x and that was quickly followed by an open source compiler. However these were all ISO Pascal implementations and as the wast bulk of OS/2 users came from the DOS world what the market really wanted was Turbo Pascal compatible systems.

IBM was acutely aware of this and had during the Alpha phase contracted with Borland to supply a version of TP for the operating system but that never happened, and Borland delivered the Borland C++ package instead. This course of events left IBM somewhat less than happy as there were already five commercial C/C++ compilers available for the system and it was neither what they had paid for nor what the market really needed, and on top of that was in competition with their own IBM C Set/2.

This lead to a number of smaller companies and individuals starting to develop their own Turbo Pascal compatible tools, initially there were freeware and shareware tools that allowed you to use Borland Pascal to develop software for OS/2 but later there were full blown developers system that offered compatibility with TP and/or the later Delphi system from Borland. None of these however saw a release until the mid 90s and most were delivered in the latter half of the decade even though one of them had been developed as early as 1993, but as all developers were small companies or individuals they were reluctant to spend money on developing and marketing something that would compete with a Borland Pascal release that everyone was expecting.

This meant that unlike many OS/2 product niches that were almost starved of software there were by the latter half of the 90s no less than 10 available and supported Pascal implementations in one form or another available for the system in addition to a couple that were available but no longer received any updates. There had already been considerable attrition in the world of C/C++ where many of the smaller developers could not compete with the likes of IBM and Watcom and had to exit the market even though the total number of implementations was lower than with Pascal, but this relative glut of products had the predictable end result that while a number of these sold reasonably. None of them did so in any great number and all but two had ceased active development by 1997, but the remaining two were doing so at considerably slowed down pace.

What is interesting is that the vendors that offered versions for more than one platform fared no better than the ones that only targeted OS/2, Delphi was simply too entrenched on Windows for an alternative to have any chance of selling in any numbers and marketing on the Windows platform was considerably more expensive than for OS/2, in fact most packages sold in fewer numbers on Windows than OS/2. In hindsight it is also notable that the tools that went out of their way to emulate either Turbo Pascal or the later Delphi offer very little in the way of support for OS/2 features, none of them had SOM emitting compilers or WPS integration libraries, some of them do not even create DLLs correctly or offer properly threaded libraries.

OS/2 implementations

16-bit
32-bit

Commercial

Open source

Libraries

  • LZ4 - Compression library (Delphi) - Open source
Foreign libraries with Pascal bindings
Open Source

Related utilities

Text editors

  • Boxer - Pascal syntax highlighting support built in
  • BRIEF - Pascal and Turbo Pascal support included by default
  • Elvis - Pascal syntax support included by default - Open source
  • Enhanced Editor - Has syntax highlighting, auto-formatting and automatic code summary for Pascal.
  • FTE - Has support for syntax highlighting, code folding and syntax-aware autoindent.
  • Future Wave Editor - syntax support included by default
  • NEdit - XFree86 - Autoindent, autocomplete and syntax highlighting - Open source
  • Preditor/2 - Pascal template with syntax highlighting
  • Visual SlickEdit

DOS implementations

Open source

Commercial

Text editors

  • Boxer - Pascal syntax highlighting support built in
  • BRIEF - Pascal and Turbo Pascal support included by default
  • Elvis - Pascal syntax support included by default - Open source
  • FTE - Has support for syntax highlighting, code folding and syntax-aware autoindent. - Open source

Win-OS/2 Implementations

Closely related language variants
  • Turing - Early version ran under Win-OS/2 or Win32s - Modern version run fine under Odin - Excellent teaching or self learning tool.

Java Implementations

Text editors
  • jEdit - Java based editor - Pascal syntax highlighting built in

Publications

  • Niklaus Wirth: The Programming Language Pascal - 1973 revised edition.
  • Gerd Bohlender, Christian Ullrich, Jürgen Wolff von Gudenberg: Pascal-SC: A Computer Language for Scientific Computation Academic Press 1987, ISBN 0-12-11155-5

Links

USENET
Tutorials and other learning material

Standards

Early on most Pascal implementations were based on code from ETH so even if they derived from the original "The Programming Language Pascal" book, code remained fairly portable as most changes were additions rather than base changes. UCSD Pascal, an extended interpreter based on an earlier ETH version became very influential especially in the USA, initially a commercial system but was later found to be in the Public Domain as it had been developed with funds from the public purse and was therefore taken on by a number of companies as the base for their systems, most notably Apple that used it and home built derivatives as the main development tools for the Apple III, Lisa and Macintosh. Similarly Microsoft used UCSD not only as the basis of their Microsoft Pascal offering but based their in house C compiler on the package.

The main obstacle to the propagation of Pascal standards has been Turbo Pascal, it was originally a CP/M compiler that implements a Pascal subset in assembly code in order to work with the extreme memory constraints of the 8 bit Z80, cutting a lot of corners to make the system faster to work with. When it was ported to DOS it was more or less a straight port that took no advantage of the larger memory capabilities of the IBM PC. This is in some ways understandable since the 8088 equipped PC/XT, although capable of directly addressing a much larger memory space than the Z80, is really an 8 bit processor in disguise and was a dog speedwise, in real terms slower than many of the Z80 systems it replaced so sacrificing code quality and features for compilation speed made some sense on these early systems.

Due to its low price in addition to good support and marketing by developer Borland it became not only by far the best selling Pascal implementation on the planet but the best selling development system of any sort for the next decade. In order to leverage its position in the market Borland decided to scrap the development of the next generation multi language system that they had been working on for some time that featured an ISO compliant Pascal (although it resurfaced later as TopSpeed Pascal and was the basis for the other TopSpeed compilers as well) and continue with the Turbo Pascal line that had established itself as a de-facto standard, and add some extensions taken from Apple's Object Pascal and some changes that allowed better compatibility with C headers and development systems.

This left us with Borland Pascal and Delphi, that manage to be both Pascal subsets and supersets at the same time, lack portability and have become somewhat muddled, with inconsistent syntax, lacking the coherence and simplicity of the ISO standards in addition to imports from C/C++ that look out of place and should really have been implemented as libraries rather than language features. This "divide and rule" strategy was initially successful as both systems sold well for a time and almost all commercial and open source tools developed since ape the Turbo Pascal/Delphi syntax rather than ISO Pascal, but in the long term it became a disaster, especially the decision to scrap the multi-language compiler which was a tool the company had to recreate later at a considerable cost and it is one of the reasons the Borland company no longer exists.

  • A list of Pascal standards from the Pascal Central site, the site also has the texts of most of them.
  • Initial "standard" was simply the 1970 edition of the book "The Programming Language Pascal" by Niklaus Wirth.
  • The Pascal-S subset, is not as often reported a "educational subset" of Pascal, but rather a minimal version of the language that ran much faster on the ETH CDC computer than the full blown Pascal system, allowing students a better chance of getting their programs compiled and run on the system than with a full compiler kit. Language report to be found here.
  • The original Pascal report got a few revisions such as the 1972 and 1973 edition of the book "The Programming Language Pascal (Revised)" by Niklaus Wirth.
  • UCSD and ETH P4 interpreters become de-facto standards with most Pascal implementation following the one or the other.
  • ISO 7185 Pascal is basically ETH P4 with some clarifications and minor changes, it was ratified in 1982 and received some further changes in 1990 primarily to enhance compatibility with ISO 10206, and is in common usage referred to as "Standard Pascal". It had a strong following for a while but ISO compliant programming tools are getting thin on the ground these days due to the popularity of TP compatible tools.
  • ANSI ratified a standard in 1983 that was based on the "home grown" UCSD Pascal but deferred to ISO Pascal in regards to the base language, this was largely ignored and no-one appears to have released tools based on this standard, but the ANSI standards group merged with an IEEE Pascal standards group and they collaborated with the ISO standards committee over the next few years resulting in the "Extended Pascal" standard below.
  • The Open Group added their own clarifications and minor additions to ISO for increased code portability in the Product Standard for Operating System and Languages: Pascal Language
  • ISO 10206 was ratified in 1990 and is commonly known as "Extended Pascal", it adds expressions, the module system and separate compilation from Modula-2, non-static types, mathematical types and a whole host of other primarily minor goodies but also makes some of the syntax more flexible.
  • The Object Pascal variant that was used in Apple Pascal and Borland Pascal/Delphi has never been standardised and most implementations simply ape the Apple syntax and later Borland additions. There was an attempt in the early 90s to create a standard but as Apple was switching to C in wake of their collaboration with IBM on PINK and Borland had no interest in what they saw as a tool to help their competitors create compatible systems, so the attempt floundered due to lack of industry support.
  • In 1993 object-oriented extensions for Standard and Extended Pascal were proposed, you can read proposals here