Advertisement

Pascal programming language

From Academic Kids

Pascal is one of the landmark computer programming languages on which generations of students "cut their teeth" and variants of which are still widely used today. The popular typesetting system TeX and much of the original Macintosh operating system were written in Pascal.

The Swiss computer scientist Niklaus Wirth developed Pascal in 1970, first as a hypothetical language that would encourage students to write structured code. Pascal is based on the Algol programming language and is named in honor of mathematician and philosopher Blaise Pascal. Wirth also developed Modula-2 and Oberon, languages similar to Pascal which also support object-oriented programming.

Contents

Overview

All Pascal programs start with the "Program" keyword, an optional list of internal file descriptors and then a block of code is indicated with the "Begin" and "End" keywords. Letter case is ignored in the Pascal language. Semicolons separate statements, and the full stop ends the program (or unit). For some compilers the "Program" line is optional.

Pascal, in its original form, is a purely procedural language with the standard array of if, while, for, and related constructs.

Turbo Pascal, and other derivatives with units or module concepts are modular languages. Turbo Pascal copied these concepts from either a draft of the Extended Pascal standard or Pascal's successor Modula-2. However, it does not provide a nested module concept.

Hello World

program HelloWorld(input, output);
begin
 Writeln('Hello, World!');
end.

Implementations

The first Pascal compiler was designed in Zurich for the CDC 6000 computer family, and it became operational in 1970.

The first Pascal compiler written in North America was constructed at the University of Illinois under Donald B. Gillies for the PDP-11 and generated native machine code.

In order to rapidly propagate the language, a compiler "porting kit" was created in Zurich that included a compiler for a "virtual" machine code (or more properly an intermediate code), and a simulator for that same code. This became the P-system. Although this system was intended to enable true machine code compilers to be created, at least one system, the notable UCSD implementation, utilized it to create an interpretive system UCSD p-System.

IP Pascal is an implementation of the Pascal programming language using the Micropolis DOS, but was moved rapidly to CP/M running on the Z80.

In the early 1980s, UCSD Pascal was ported to the Apple II and Apple III computers to provide a structured alternative to the BASIC interpreters that came with the machines.

In the 1980s Anders Hejlsberg wrote the Blue Label Pascal compiler for the Nascom-2. Later he went to work for Borland and rewrote his compiler to become Turbo Pascal for the IBM PC. This new compiler sold for $49.95, which was much less than the price Hejlsberg originally asked for the Blue Label Pascal compiler.

The inexpensive Borland compiler had a large influence on the Pascal community that began concentrating mainly on the IBM PC in the late 1980s. Many PC hobbyists in search of a structured replacement for BASIC used this product. Turbo Pascal, being available only on one architecture, translated directly to Intel 8088 machine code, making it much faster than interpreted schemes.

Super Pascal was a variant which added non-numeric labels, a return statement and expressions as names of types.

During the 1990s compilers that could be re-targeted to different hardware architectures became more prevalent. This allowed for Pascal translation to native machine code that was at the same time easily ported to new hardware.

With Turbo Pascal version 5.5 Borland added object orientation to Pascal.

However, Borland later decided it wanted more elaborate object-oriented features, and started over in Delphi using the Object Pascal draft standard proposed by Apple as a basis. (This Apple draft is not a formal standard yet.) Borland also called this Object Pascal in the first Delphi versions, but changed the name to Delphi programming language in later versions. The main additions compared to the older OOP extensions were a reference-based object model, virtual constructors and destructors, and properties. There are several other compilers implementing this dialect: see Delphi programming language.

Standards

In 1983, the language was standardized, in the international standard ISO/IEC 7185, as well as several local country specific standards, including the American ANSI/IEEE770X3.97-1983. In 1990, an extended Pascal standard was created as ISO/IEC 10206.

The ISO 7185 was stated to be a clarification of Wirth's 1974 language as detailed by the User Manual and Report [Jensen and Wirth], but was also notable for adding "Conformant Array Parameters" as a level 1 to the standard, level 0 being Pascal without Conformant Arrays.

On the large machines (mainframes and minicomputers) Pascal originated on, the standards were generally followed. On the IBM-PC, they were not. On IBM-PCs, the Borland standards Turbo Pascal and Delphi have the greatest number of users. Thus, it is typically important to understand whether a particular implementation corresponds to the original Pascal language, or a Borland dialect of it.

Publicly available compilers

Several Pascal compilers are available for the use of general public:

  • P4 compiler (http://homepages.cwi.nl/~steven/pascal/), the basis for many subsequent Pascal-implemented-in-Pascal compilers, including the UCSD p-System.
  • Free Pascal is written in Pascal (so that it compiles itself), and is aimed at providing a convenient and powerful compiler, able both to compile legacy applications and to be the means of develop new ones. Also distributed freely under the GNU GPL. It can mix Turbo Pascal with Delphi code, and supports a lot of platforms and operating systems.
  • Turbo Pascal was the dominant Pascal compiler for PCs during the 80s and early 90s, popular both because of its powerful extensions and extremely low compilation times. Currently, older versions of Turbo Pascal (up to 5.5) are available for free download from Borland's site (registration required).
  • Chrome (http://www.chromesville.com) is a next generation Object Pascal language for the .NET and Mono Platforms implemented by RemObjects Software.
  • GNU Pascal Compiler (http://www.gnu-pascal.org/) (GPC) is the Pascal compiler of the GNU Compiler Collection (GCC). The compiler itself is written in C, the runtime library mostly in Pascal. Distributed freely under the GNU General Public License, it runs on many platforms and operating systems. It supports the ANSI/ISO standard languages and the Borland/Turbo Pascal language largely. Support for Borland Delphi and other language variations is quite limited yet.
  • Delphi (http://www.borland.com/delphi/) is Borland's flagship RAD (Rapid Application Development) product. It uses the Delphi programming language, descended from Pascal, to create applications for the windows platform. The latest version also supports compiling to the .NET platform
  • Kylix (http://www.borland.com/kylix/) is Borland's newest reiteration of the Pascal branch of their products. It is the descendant of Delphi, with support for the Linux operating system and an improved object library. The compiler and the IDE are available now for non-commercial use. The compiler (but not the library or the IDE) is supposed to become Open Source software some time soon.
  • Virtual Pascal (http://www.vpascal.com/) was created by Vitaly Miryanov in 1995 as a native OS/2 compiler compatible with Borland Pascal syntax. Then it had been commercially developed by fPrint, adding Win32 support, and in 2000 it became freeware. Today it can compile for Win32, OS/2 and Linux, and is mostly compatible with Borland Pascal and Delphi.
  • IP Pascal (http://www.moorecad.com/ippas/) Originally a Z80/CP/M Pascal that was ported and recoded for Intel 80386/PC, IP Pascal has a built-in portability library that is custom tailored to the Pascal language. For example, a standard text output application from 1970's original Pascal can be recompiled to work in a window and even have graphical constructs added. IP Pascal supports the ISO 7185 standard and upgrades the language logically. For example, original Pascal "padded right" strings are supported and integrated upwards seamlessly into dynamic strings. Standard Pascal static arrays are enhanced with dynamic arrays which are fully downward compatible with static arrays, etc.

A very extensive list can be found on Pascaland (http://pascaland.org). The site is in French, but it is basically a list with URLs to compilers, so that does not matter. You may also check out Pascal Central (http://pascal-central.com), a Pascal info and advocacy site with rich collection of article archives, plus links to many compilers and tutorials.

Past criticism

While very popular (although more so in the 1980s and early 1990s than at the time of writing), early versions of Pascal have been widely criticised for being unsuitable for "serious" use outside of teaching. Brian Kernighan, famed populariser of the C programming language, outlined his most notable criticisms of Pascal as early as 1981, in his paper Why Pascal Is Not My Favorite Programming Language (http://www.lysator.liu.se/c/bwk-on-pascal.html). On the other hand, many major development efforts in the 1980s, such as for the Apple Lisa and Macintosh, heavily depended on Pascal. In the decades since then, Pascal has continued to evolve and most of his points do not apply to current implementations. Unfortunately, most of the extensions to fix these issues are incompatible from compiler to compiler, though the last decade this seems to condense into two categories, ISO or Borland like.

Further reading

See also

External links

  • Pascal Central (http://pascal-central.com/) — the one-stop Pascal resource site

Template:Major programming languages smallbg:Pascal cs:Pascal (programovac jazyk) da:Pascal de:Pascal (Programmiersprache) et:Pascal es:Lenguaje de programacin Pascal eo:Pascal fr:Pascal (langage) gl:Linguaxe Pascal ko:파스칼 프로그래밍 언어 id:Pascal (bahasa pemrograman) it:Pascal (linguaggio) he:Pascal lt:Pascal hu:Pascal programozsi nyelv mk:Паскал nl:Pascal (programmeertaal) ja:Pascal pl:Pascal (język programowania) pt:Pascal (linguagem de programao) ro:Limbajul Pascal ru:Паскаль (язык программирования) sk:Pascal (programovac jazyk) sl:Programski jezik pascal fi:Pascal-ohjelmointikieli sv:Pascal (programsprk) th:ภาษาปาสกาล tr:Pascal programlama dili uk:Мова програмування Pascal zh:Pascal

Navigation

Academic Kids Menu

  • Art and Cultures
    • Art (http://www.academickids.com/encyclopedia/index.php/Art)
    • Architecture (http://www.academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (http://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (http://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools