Pascal is an influential
imperativeIn computer science, imperative programming is a programming paradigm that describes computation in terms of statements that change a program state...
and
proceduralProcedural programming can sometimes be used as a synonym for imperative programming , but can also refer to a programming paradigm, derived from structured programming, based upon the concept of the procedure call...
programming languageA programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....
, designed in 1968/9 and published in 1970 by
Niklaus WirthNiklaus Emil Wirth is a Swiss computer scientist, best known for designing several programming languages, including Pascal, and for pioneering several classic topics in software engineering. In 1984 he won the Turing Award for developing a sequence of innovative computer languages.-Biography:Wirth...
as a small and efficient language intended to encourage good programming practices using
structured programmingStructured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could...
and
data structuringIn computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks...
.
A derivative known as
Object PascalObject Pascal refers to a branch of object-oriented derivatives of Pascal, mostly known as the primary programming language of Embarcadero Delphi.-Early history at Apple:...
designed for
object-oriented programmingObject-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
was developed in 1985.
History
Pascal was developed by
Niklaus WirthNiklaus Emil Wirth is a Swiss computer scientist, best known for designing several programming languages, including Pascal, and for pioneering several classic topics in software engineering. In 1984 he won the Turing Award for developing a sequence of innovative computer languages.-Biography:Wirth...
and based on the
ALGOLALGOL is a family of imperative computer programming languages originally developed in the mid 1950s which greatly influenced many other languages and became the de facto way algorithms were described in textbooks and academic works for almost the next 30 years...
programming language, named in honor of the French mathematician and philosopher
Blaise Pascal Blaise Pascal , was a French mathematician, physicist, inventor, writer and Catholic philosopher. He was a child prodigy who was educated by his father, a tax collector in Rouen...
.
Prior to his work on Pascal, Wirth had developed Euler and
ALGOL WALGOL W is a programming language. It was based on a proposal for ALGOL X by Niklaus Wirth and C. A. R. Hoare as a successor to ALGOL 60 in IFIP Working Group 2.1. When the committee decided that the proposal was not a sufficient advance over ALGOL 60, the proposal was published as A contribution...
and later went on to develop the Pascal-like languages
Modula-2Modula-2 is a computer programming language designed and developed between 1977 and 1980 by Niklaus Wirth at ETH Zurich as a revision of Pascal to serve as the sole programming language for the operating system and application software for the personal workstation Lilith...
and
OberonOberon is a programming language created in 1986 by Professor Niklaus Wirth and his associates at ETH Zurich in Switzerland. It was developed as part of the implementation of the Oberon operating system...
.
Initially, Pascal was largely, but not exclusively, intended to teach students
structured programmingStructured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could...
. A generation of students used Pascal as an introductory language in undergraduate courses. Variants of Pascal have also frequently been used for everything from research projects to PC games and embedded systems. Newer Pascal compilers exist which are widely used.
Pascal was the primary high-level language used for development in the
Apple LisaThe Apple Lisa—also known as the Lisa—is a :personal computer designed by Apple Computer, Inc. during the early 1980s....
, and in the early years of the Mac. Parts of the original Macintosh operating system were hand-translated into
Motorola 68000The Motorola 68000 is a 16/32-bit CISC microprocessor core designed and marketed by Freescale Semiconductor...
assembly languageAn assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...
from the Pascal sources. The popular
typesettingTypesetting is the composition of text by means of types.Typesetting requires the prior process of designing a font and storing it in some manner...
system
TeXTeX is a typesetting system designed and mostly written by Donald Knuth and released in 1978. Within the typesetting system, its name is formatted as ....
by Donald E. Knuth was written in
WEBWEB is a computer programming system created by Donald E. Knuth as the first implementation of what he called "literate programming": the idea that one could create software as works of literature, by embedding source code inside descriptive text, rather than the reverse , in an order that is...
, the original
literate programmingLiterate programming is an approach to programming introduced by Donald Knuth as an alternative to the structured programming paradigm of the 1970s....
system, based on
DECDigital Equipment Corporation was a major American company in the computer industry and a leading vendor of computer systems, software and peripherals from the 1960s to the 1990s...
PDP-10The PDP-10 was a mainframe computer family manufactured by Digital Equipment Corporation from the late 1960s on; the name stands for "Programmed Data Processor model 10". The first model was delivered in 1966...
Pascal, while an application like
Total CommanderTotal Commander is an Orthodox File Manager software for Windows, Windows CE, and Windows Mobile. Some features include a built-in FTP client, file compare, archive file navigation, and a versatile multi-rename tool with regular expression support....
was written in Delphi (
Object PascalObject Pascal refers to a branch of object-oriented derivatives of Pascal, mostly known as the primary programming language of Embarcadero Delphi.-Early history at Apple:...
).
Object Pascal is still used for developing Windows applications such as
SkypeSkype is a software application that allows users to make voice and video calls and chat over the Internet. Calls to other users within the Skype service are free, while calls to both traditional landline telephones and mobile phones can be made for a fee using a debit-based user account system...
. A cross-platform version called
Free PascalFree Pascal Compiler is a free Pascal and Object Pascal compiler.In addition to its own Object Pascal dialect, Free Pascal supports, to varying degrees, the dialects of several other compilers, including those of Turbo Pascal, Delphi, and some historical Macintosh compilers...
, with the Lazarus IDE, is popular with Linux users since it promises
write once, compile anywhereWrite once, compile anywhere refers to writing software that compiles, and is thus usable, on all platforms. As opposed to Sun's write once, run anywhere slogan, cross-platform compatibility is implemented at the source code level, rather than at the compiled binary code level.There are many...
, development.
Brief description
Wirth's intention was to create an efficient language (regarding both compilation speed and generated code) based on so-called
structured programmingStructured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could...
, a concept which had recently become popular. Pascal has its roots in the
ALGOL 60ALGOL 60 is a member of the ALGOL family of computer programming languages. It gave rise to many other programming languages, including BCPL, B, Pascal, Simula, C, and many others. ALGOL 58 introduced code blocks and the begin and end pairs for delimiting them...
language, but also introduced concepts and mechanisms which (on top of ALGOL's scalars and arrays) enabled programmers to define their own complex (structured) datatypes, and also made it easier to build dynamic and recursive data structures such as
lists,
trees and
graphs. Important features included for this were
records,
enumerations,
subranges,
dynamically allocated variables with associated
pointers, and
sets. To make this possible and meaningful, Pascal has a strong typing on all objects, which means that one type of data cannot be converted or interpreted as another without
explicit conversions. Similar mechanisms are standard in many programming languages today. Other languages that influenced Pascal's development were
COBOLCOBOL is one of the oldest programming languages. Its name is an acronym for COmmon Business-Oriented Language, defining its primary domain in business, finance, and administrative systems for companies and governments....
,
SimulaSimula is a name for two programming languages, Simula I and Simula 67, developed in the 1960s at the Norwegian Computing Center in Oslo, by Ole-Johan Dahl and Kristen Nygaard...
67, and Wirth's own
ALGOL WALGOL W is a programming language. It was based on a proposal for ALGOL X by Niklaus Wirth and C. A. R. Hoare as a successor to ALGOL 60 in IFIP Working Group 2.1. When the committee decided that the proposal was not a sufficient advance over ALGOL 60, the proposal was published as A contribution...
.
Pascal, like many programming languages of today (but unlike most languages in the C family), allows nested procedure definitions to any level of depth, and also allows most kinds of definitions and declarations inside procedures and functions. This enables a very simple and coherent syntax where a complete
program is syntactically nearly identical to a single
procedure or
function (except for the keyword itself, of course.)
Implementations
The first Pascal
compilerA compiler is a computer program that transforms source code written in a programming language into another computer language...
was designed in
ZürichZurich is the largest city in Switzerland and the capital of the canton of Zurich. It is located in central Switzerland at the northwestern tip of Lake Zurich...
for the
CDC 6000 seriesThe CDC 6000 series was a family of mainframe computers manufactured by Control Data Corporation in the 1960s. It consisted of CDC 6400, CDC 6500, CDC 6600 and CDC 6700 computers, which all were extremely rapid and efficient for their time...
mainframe computerMainframes are powerful computers used primarily by corporate and governmental organizations for critical applications, bulk data processing such as census, industry and consumer statistics, enterprise resource planning, and financial transaction processing.The term originally referred to the...
family.
Niklaus WirthNiklaus Emil Wirth is a Swiss computer scientist, best known for designing several programming languages, including Pascal, and for pioneering several classic topics in software engineering. In 1984 he won the Turing Award for developing a sequence of innovative computer languages.-Biography:Wirth...
reports that a first attempt to implement it in
FortranFortran is a general-purpose, procedural, imperative programming language that is especially suited to numeric computation and scientific computing...
in 1969 was unsuccessful due to Fortran's inadequacy to express complex data structures. The second attempt was formulated in the Pascal language itself and was operational by mid-1970. Many Pascal compilers since have been similarly
self-hostingThe term self-hosting was coined to refer to the use of a computer program as part of the toolchain or operating system that produces new versions of that same program—for example, a compiler that can compile its own source code. Self-hosting software is commonplace on personal computers and larger...
, that is, the compiler is itself written in Pascal, and the compiler is usually capable of recompiling itself when new features are added to the language, or when the compiler is to be
portedIn computer science, porting is the process of adapting software so that an executable program can be created for a computing environment that is different from the one for which it was originally designed...
to a new environment. The
GNU PascalGNU Pascal is a Pascal compiler composed of a frontend to GNU Compiler Collection , similar to the way Fortran and other languages were added to GCC...
compiler is one notable exception, being written in C.
The first successful port of the CDC Pascal compiler to another mainframe was completed by Welsh and Quinn at the
QUBQueen's University Belfast is a public research university in Belfast, Northern Ireland. The university's official title, per its charter, is the Queen's University of Belfast. It is often referred to simply as Queen's, or by the abbreviation QUB...
in 1972. The target was the ICL
1900 seriesICT 1900 was the name given to a series of mainframe computers released by International Computers and Tabulators and later International Computers Limited during the 1960s and '70s...
. This compiler in turn was the parent of the Pascal compiler for the ICS Multum minicomputer. The Multum port was developed – with a view to using Pascal as a systems programming language – by Findlay, Cupples, Cavouras and Davis, working at the Department of Computing Science in Glasgow University. It is thought that Multum Pascal, which was completed in the summer of 1973, may have been the first 16-bit implementation.
A completely new compiler was completed by Welsh et al. at QUB in 1977. It offered a source-language diagnostic feature (incorporating profiling, tracing and type-aware formatted postmortem dumps) that was implemented by Findlay and Watt at Glasgow University. This implementation was ported in 1980 to the ICL 2900 series by a team based at Southampton University and Glasgow University. The Standard Pascal Model Implementation was also based on this compiler, having been adapted, by Welsh and Hay at Manchester University in 1984, to check rigorously for conformity to the BSI 6192/ISO 7185 Standard and to generate code for a portable abstract machine.
The first Pascal
compilerA compiler is a computer program that transforms source code written in a programming language into another computer language...
written in North America was constructed at the
University of IllinoisThe University of Illinois at Urbana–Champaign is a large public research-intensive university in the state of Illinois, United States. It is the flagship campus of the University of Illinois system...
under Donald B. Gillies for the
PDP-11The PDP-11 was a series of 16-bit minicomputers sold by Digital Equipment Corporation from 1970 into the 1990s, one of a succession of products in the PDP series. The PDP-11 replaced the PDP-8 in many real-time applications, although both product lines lived in parallel for more than 10 years...
and generated native machine code.
To propagate the language rapidly, a compiler "porting kit" was created in Zurich that included a compiler that generated code for a "virtual" stack machine (i.e. code that lends itself to reasonably efficient interpretation), along with an interpreter for that code - the
Pascal-P system. The P-system compilers were termed Pascal-P1, Pascal-P2, Pascal-P3, and Pascal-P4. Pascal-P1 was the first version, and Pascal-P4 was the last to come from Zurich.
The Pascal-P4 compiler/interpreter can still be run and compiled on systems compatible with original Pascal. However, it only accepts a subset of the Pascal language.
Pascal-P5, created outside of the Zurich group, accepts the full Pascal language and includes ISO 7185 compatibility.
UCSD Pascal branched off Pascal-P2, where
Kenneth BowlesDr. Kenneth L "Ken" Bowles is best known for his work in initiating and directing the UCSD Pascal project, when he was a professor of Computer Science at the University of California, San Diego .- Education :Bowles received his PhD under Prof...
utilized it to create the
interpretiveIn computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...
UCSD p-System
A compiler based on the Pascal-P4 compiler, which created native binaries, was released for the IBM System/370
mainframe computerMainframes are powerful computers used primarily by corporate and governmental organizations for critical applications, bulk data processing such as census, industry and consumer statistics, enterprise resource planning, and financial transaction processing.The term originally referred to the...
by the
Australian Atomic Energy CommissionThe Australian Atomic Energy Commission was a statutory body of the Australian government.It was established in 1952, replacing the Atomic Energy Policy Committee. In 1981 parts of the Commission were split off to become part of CSIRO, the remainder continuing until 1987, when it was replaced by...
; it was called the "AAEC Pascal Compiler" after the abbreviation of the name of the Commission.
In the early 1980s,
WatcomWatcom International Corporation was founded in 1981 by three former employees of the Computer Systems Group at the University of Waterloo, in Waterloo, Ontario, Canada...
Pascal was developed, also for the IBM System 370.
IP PascalIP Pascal is an implementation of the Pascal programming language using the IP portability platform, a multiple machine, operating system and language implementation system.- Overview :...
was an implementation of the Pascal programming language using Micropolis DOS, but was moved rapidly to
CP/MCP/M was a mass-market operating system created for Intel 8080/85 based microcomputers by Gary Kildall of Digital Research, Inc...
running on the
Z80The Zilog Z80 is an 8-bit microprocessor designed by Zilog and sold from July 1976 onwards. It was widely used both in desktop and embedded computer designs as well as for military purposes...
. It was moved to the 80386 machine types in 1994, and exists today as Windows/XP and Linux implementations. In 2008, the system was brought up to a new level and the resulting language termed "Pascaline" (after Pascal's calculator). It includes objects, namespace controls,
dynamic arrayIn computer science, a dynamic array, growable array, resizable array, dynamic table, or array list is a random access, variable-size list data structure that allows elements to be added or removed...
s, along with many other extensions, and generally features the same functionality and type protection as C#. It is the only such implementation which is also compatible with the original Pascal implementation (which is standardized as ISO 7185).
In the early 1980s, UCSD Pascal was ported to the
Apple IIThe Apple II is an 8-bit home computer, one of the first highly successful mass-produced microcomputer products, designed primarily by Steve Wozniak, manufactured by Apple Computer and introduced in 1977...
and
Apple IIIThe Apple III is a business-oriented personal computer produced and released by Apple Computer that was intended as the successor to the Apple II series, but largely considered a failure in the market. Development work on the Apple III started in late 1978 under the guidance of Dr. Wendell Sander...
computers to provide a structured alternative to the
BASICBASIC is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use - the name is an acronym from Beginner's All-purpose Symbolic Instruction Code....
interpreters that came with the machines.
Apple Computer created its own Lisa Pascal for the Lisa Workshop in 1982 and ported this compiler to the Apple Macintosh and
MPWMacintosh Programmer's Workshop or MPW, is a software development environment for the Classic Mac OS, written by Apple Computer. For Macintosh developers, it was one of the primary tools for building applications for System 7.x and Mac OS 8.x and 9.x. Initially, MPW was sold as a commercial product...
in 1985. In 1985 Larry Tesler, in consultation with Niklaus Wirth, defined Object Pascal and these extensions were incorporated in both the Lisa Pascal and Mac Pascal compilers.
In the 1980s
Anders HejlsbergAnders Hejlsberg is a prominent Danish software engineer who co-designed several popular and commercially successful programming languages and development tools...
wrote the Blue Label Pascal compiler for the
NascomThe Nascom 1 and 2 were single-board computer kits issued in 1977 and 1979, respectively, based on the Zilog Z80 and including a keyboard and video interface, a serial port that could be used to store data on a tape cassette using the Kansas City standard, and two 8-bit parallel ports...
-2. A reimplementation of this compiler for the
IBM PCThe IBM Personal Computer, commonly known as the IBM PC, is the original version and progenitor of the IBM PC compatible hardware platform. It is IBM model number 5150, and was introduced on August 12, 1981...
was marketed under the names Compas Pascal and PolyPascal before it was acquired by
BorlandBorland Software Corporation is a software company first headquartered in Scotts Valley, California, Cupertino, California and finally Austin, Texas. It is now a Micro Focus subsidiary. It was founded in 1983 by Niels Jensen, Ole Henriksen, Mogens Glad and Philippe Kahn.-The 1980s:...
. Renamed to
Turbo PascalTurbo Pascal is a software development system that includes a compiler and an integrated development environment for the Pascal programming language running on CP/M, CP/M-86, and DOS, developed by Borland under Philippe Kahn's leadership...
it became hugely popular, thanks in part to an aggressive pricing strategy and in part to having one of the first full-screen
Integrated development environmentAn integrated development environment is a software application that provides comprehensive facilities to computer programmers for software development...
s, and fast turnaround-time (just seconds to compile, link, and run.) Additionally, it was written and highly optimized entirely in
assembly languageAn assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...
, making it
smallerMemory footprint refers to the amount of main memory that a program uses or references while running.This includes all sorts of active memory regions like code, static data sections , heap, as well as all the stacks, plus memory required to hold any additional data structures, such as symbol...
and faster than much of the competition. In 1986 Anders ported Turbo Pascal to the Macintosh and incorporated Apple's Object Pascal extensions into Turbo Pascal. These extensions were then added back into the PC version of Turbo Pascal for version 5.5. At the same time
MicrosoftMicrosoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...
also implemented the Object Pascal compiler. Turbo Pascal 5.5 had a large influence on the Pascal community, which began concentrating mainly on the IBM PC in the late 1980s. Many PC hobbyists in search of a structured replacement for
BASICBASIC is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use - the name is an acronym from Beginner's All-purpose Symbolic Instruction Code....
used this product. It also began to be adopted by professional developers. Around the same time a number of concepts were imported from
CC is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
to let Pascal programmers use the C-based
APIAn application programming interface is a source code based specification intended to be used as an interface by software components to communicate with each other...
of
Microsoft WindowsMicrosoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
directly. These extensions included null-terminated
stringIn formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet....
s, pointer arithmetic,
function pointerA function pointer is a type of pointer in C, C++, D, and other C-like programming languages, and Fortran 2003. When dereferenced, a function pointer can be used to invoke a function and pass it arguments just like a normal function...
s, an address-of operator and unsafe
typecastsIn computer science, type conversion, typecasting, and coercion are different ways of, implicitly or explicitly, changing an entity of one data type into another. This is done to take advantage of certain features of type hierarchies or type representations...
.
However, Borland later decided it wanted more elaborate object-oriented features, and started over in Delphi using the
Object PascalObject Pascal refers to a branch of object-oriented derivatives of Pascal, mostly known as the primary programming language of Embarcadero Delphi.-Early history at Apple:...
draft standard proposed by
AppleApple Inc. is an American multinational corporation that designs and markets consumer electronics, computer software, and personal computers. The company's best-known hardware products include the Macintosh line of computers, the iPod, the iPhone and the iPad...
as a basis. (This Apple draft is still not a formal standard.) The first versions of the Delphi language were accordingly named Object Pascal. The main additions compared to the older OOP extensions were a reference-based object model, virtual constructors and destructors, and properties. Several other compilers also implement this dialect.
Turbo PascalTurbo Pascal is a software development system that includes a compiler and an integrated development environment for the Pascal programming language running on CP/M, CP/M-86, and DOS, developed by Borland under Philippe Kahn's leadership...
, and other derivatives with units or module concepts are
modular languagesModular programming is a software design technique that increases the extent to which software is composed of separate, interchangeable components called modules by breaking down program functions into modules, each of which accomplishes one function and contains everything necessary to accomplish...
. However, it does not provide a nested module concept or qualified import and export of specific symbols.
Super Pascal was a variant which added non-numeric labels, a return statement and expressions as names of types.
The universities of
ZurichZurich is the largest city in Switzerland and the capital of the canton of Zurich. It is located in central Switzerland at the northwestern tip of Lake Zurich...
,
KarlsruheThe City of Karlsruhe is a city in the southwest of Germany, in the state of Baden-Württemberg, located near the French-German border.Karlsruhe was founded in 1715 as Karlsruhe Palace, when Germany was a series of principalities and city states...
and
WuppertalWuppertal is a city in North Rhine-Westphalia, Germany. It is located in and around the Wupper river valley, and is situated east of the city of Düsseldorf and south of the Ruhr area. With a population of approximately 350,000, it is the largest city in the Bergisches Land...
have developed an
EXtension for Scientific Computing (Pascal XSC), which provides a free solution for programming numerical computations with controlled precision.
Language constructs
Pascal, in its original form, is a purely procedural language and includes the traditional array of
ALGOLALGOL is a family of imperative computer programming languages originally developed in the mid 1950s which greatly influenced many other languages and became the de facto way algorithms were described in textbooks and academic works for almost the next 30 years...
-like control structures with reserved words such as
if,
then,
else,
while,
for, and so on. However, Pascal also has many data structuring facilities and other abstractions which were not included in the original
ALGOL 60ALGOL 60 is a member of the ALGOL family of computer programming languages. It gave rise to many other programming languages, including BCPL, B, Pascal, Simula, C, and many others. ALGOL 58 introduced code blocks and the begin and end pairs for delimiting them...
, like
type definitionsA type system associates a type with each computed value. By examining the flow of these values, a type system attempts to ensure or prove that no type errors can occur...
,
recordIn computer science, a record is an instance of a product of primitive data types called a tuple. In C it is the compound data in a struct. Records are among the simplest data structures. A record is a value that contains other values, typically in fixed number and sequence and typically indexed...
s, pointers,
enumerationIn computer programming, an enumerated type is a data type consisting of a set of named values called elements, members or enumerators of the type. The enumerator names are usually identifiers that behave as constants in the language...
s, and
setIn computer science, a set is an abstract data structure that can store certain values, without any particular order, and no repeated values. It is a computer implementation of the mathematical concept of a finite set...
s. Such constructs were in part inherited or inspired from
SimulaSimula is a name for two programming languages, Simula I and Simula 67, developed in the 1960s at the Norwegian Computing Center in Oslo, by Ole-Johan Dahl and Kristen Nygaard...
67,
ALGOL 68ALGOL 68 isan imperative computerprogramming language that was conceived as a successor to theALGOL 60 programming language, designed with the goal of a...
,
Niklaus WirthNiklaus Emil Wirth is a Swiss computer scientist, best known for designing several programming languages, including Pascal, and for pioneering several classic topics in software engineering. In 1984 he won the Turing Award for developing a sequence of innovative computer languages.-Biography:Wirth...
's own
ALGOL WALGOL W is a programming language. It was based on a proposal for ALGOL X by Niklaus Wirth and C. A. R. Hoare as a successor to ALGOL 60 in IFIP Working Group 2.1. When the committee decided that the proposal was not a sufficient advance over ALGOL 60, the proposal was published as A contribution...
and suggestions by
C. A. R. HoareSir Charles Antony Richard Hoare , commonly known as Tony Hoare or C. A. R. Hoare, is a British computer scientist best known for the development of Quicksort, one of the world's most widely used sorting algorithms...
.
Hello world
Pascal programs start with the
program keywordIn computer programming, a keyword is a word or identifier that has a particular meaning to the programming language. The meaning of keywords — and, indeed, the meaning of the notion of keyword — differs widely from language to language....
with a list of external
file descriptorIn computer programming, a file descriptor is an abstract indicator for accessing a file. The term is generally used in POSIX operating systems...
s as parameters; then follows the main block bracketed by the
begin and
end keywords.
SemicolonThe semicolon is a punctuation mark with several uses. The Italian printer Aldus Manutius the Elder established the practice of using the semicolon to separate words of opposed meaning and to indicate interdependent statements. "The first printed semicolon was the work of ... Aldus Manutius"...
s separate
statementsIn computer programming a statement can be thought of as the smallest standalone element of an imperative programming language. A program written in such a language is formed by a sequence of one or more statements. A statement will have internal components .Many languages In computer programming...
, and the
full stopA full stop is the punctuation mark commonly placed at the end of sentences. In American English, the term used for this punctuation is period. In the 21st century, it is often also called a dot by young people...
(i.e., a period) ends the whole program (or
unit).
Letter caseIn orthography and typography, letter case is the distinction between the larger majuscule and smaller minuscule letters...
is ignored in Pascal source.
Here is an example of the source code in use for a very simple "Hello world" program:
program HelloWorld(output);
begin
Writeln('Hello world!');
end.
Data types
A type in Pascal, and in several other popular programming languages, defines a variable in such a way that it defines a range of values which the variable is capable of storing, and it also defines a set of operations that are permissible to be performed on variables of that type. The predefined types are:
| Data type |
Type of values which the variable is capable of storing |
| integer In computer science, an integer is a datum of integral data type, a data type which represents some finite subset of the mathematical integers. Integral data types may be of different sizes and may or may not be allowed to contain negative values....
|
Whole numbers |
| real In computing, floating point describes a method of representing real numbers in a way that can support a wide range of values. Numbers are, in general, represented approximately to a fixed number of significant digits and scaled using an exponent. The base for the scaling is normally 2, 10 or 16...
|
Floating point numbers |
| boolean |
The value TRUE or FALSE |
| char In computer and machine-based telecommunications terminology, a character is a unit of information that roughly corresponds to a grapheme, grapheme-like unit, or symbol, such as in an alphabet or syllabary in the written form of a natural language....
|
A single character from an ordered character set |
The range of values allowed for each (except boolean) is implementation defined. Functions are provided for some data conversions. For conversion of
real to
integer, the following functions are available:
round, which round to integer using banker's rounding;
trunc, round towards zero.
The programmer has the freedom to define other commonly-used data types (e.g. byte, string, etc.) in terms of the predefined types using Pascal's type declaration facility. e.g.
type
byte = 0..255;
signedbyte = -128..127;
string = packed array [1..255] of char;
Subrange types
Subranges of any ordinal type (any simple type except real) can be made:
var
x: 1..10;
y: 'a'..'z';
z: pear..orange;
Set types
In contrast with other programming languages from its time, Pascal supports a set type:
var
set1: set of 1..10;
set2: set of 'a'..'z';
set3: set of pear..orange;
A set is a fundamental concept for modern mathematics, and they may be used in many algorithms. Such a feature is useful and may be faster than an equivalent construct in a language that does not support sets. For example, for many Pascal compilers:
if i in [5..10] then
...
executes faster than:
if (i>4) and (i<11) then
...
Sets of non-contiguous values can be particularly useful, in terms of both performance and readability:
if i in [0..3, 7, 9, 12..15] then
...
For these examples, which involve sets over small domains, the improved performance is usually achieved by the compiler representing set variables as bitmasks. The set
operatorsProgramming languages typically support a set of operators: operations which differ from the language's functions in calling syntax and/or argument passing mode. Common examples that differ by syntax are mathematical arithmetic operations, e.g...
can then be implemented efficiently as bitwise machine code operations.
Type declarations
Types can be defined from other types using type declarations:
type
x = Integer;
y = x;
...
Further, complex types can be constructed from simple types:
type
a = Array [1..10] of Integer;
b = record
x: Integer;
y: Char
end;
c = File of a;
File type
As shown in the example above, Pascal
filesA computer file is a block of arbitrary information, or resource for storing information, which is available to a computer program and is usually based on some kind of durable storage. A file is durable in the sense that it remains available for programs to use after the current program has finished...
are sequences of components. Every file has a buffer variable which is denoted by
f^. The procedures
get (for reading) and
put (for writing) move the buffer variable to the next element. Read is introduced such that
read(f, x) is the same as
x:=f^; get(f);. Write is introduced such that
write(f, x) is the same as
f^ := x; put(f); The type text is predefined as file of char. While the buffer variable could be used for inspecting the next character to be used (check for a digit before reading an integer), this leads to serious problems with interactive programs in early implementations, but was solved later with the "lazy I/O" concept.
In Jensen & Wirth Pascal, strings are represented as packed arrays of chars; they therefore have fixed length and are usually space-padded. Some dialects have a custom string type.
Pointer types
Pascal supports the use of pointers:
type
Nodeptr = ^Node;
Node = record
a: Integer;
b: Char;
c: Nodeptr
end;
var
ptoNode: Nodeptr;
pInt : ^Integer;
Here the variable
ptoNode is a pointer to the data type
Node, a record. Pointers can be used before they are declared. This is a forward declaration, an exception to the rule that things must be declared before they are used. To create a new record and assign the value
10 and character
A to the fields
a and
b in the record, and to initialise the pointer
c to nil, the commands would be:
new(ptoNode);
...
ptoNode^.a := 10;
ptoNode^.b := 'A';
ptoNode^.c := nil;
...
This could also be done using the
with statement, as follows
new(ptoNode);
...
with ptoNode^ do
begin
a := 10;
b := 'A';
c := nil
end;
...
Inside of the scope of the
with statement, a and b refer to the subfields of the record pointer
ptoNode and not to the record Node or the pointer type Nodeptr.
Linked listIn computer science, a linked list is a data structure consisting of a group of nodes which together represent a sequence. Under the simplest form, each node is composed of a datum and a reference to the next node in the sequence; more complex variants add additional links...
s,
stacksIn computer science, a stack is a last in, first out abstract data type and linear data structure. A stack can have any abstract data type as an element, but is characterized by only three fundamental operations: push, pop and stack top. The push operation adds a new item to the top of the stack,...
and queues can be created by including a pointer type field (c) in the record (see also nil).
Unlike many languages that feature pointers, Pascal only allows pointers to reference dynamically created variables that are anonymous, and does not allow them to reference standard static or local variables. Pointers also must have an associated type, and a pointer to one type is not compatible with a pointer to another type (e.g. a pointer to a char is not compatible with a pointer to an integer). This helps eliminate the type security issues inherent with other pointer implementations, particularly those used for
PL/IPL/I is a procedural, imperative computer programming language designed for scientific, engineering, business and systems programming applications...
or
CC is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
. It also removes some risks caused by dangling pointers, but the ability to dynamically let go of referenced space by using the
dispose function (which has the same effect as the
free library function found in
CC is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
) means that the risk of dangling pointers has not been entirely eliminated.
Control structures
Pascal is a
structured programmingStructured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could...
language, meaning that the flow of control is structured into standard
statementsIn computer programming a statement can be thought of as the smallest standalone element of an imperative programming language. A program written in such a language is formed by a sequence of one or more statements. A statement will have internal components .Many languages In computer programming...
, ideally without 'goto' commands.
while a <> b do writeln('Waiting');
if a > b then
writeln('Condition met')
else
writeln('Condition not met');
for i := 1 to 10 do
writeln('Iteration: ', i:1);
repeat
a := a + 1
until a = 10;
case i of
0: write('zero');
1: write('one');
2: write('two')
end;
Procedures and functions
Pascal structures programs into procedures and functions.
program mine(output);
var i : integer;
procedure print(var j: integer);
Procedures and functions can nest to any depth, and the 'program' construct is the logical outermost block.
Each procedure or function can have its own declarations of goto labels, constants, types, variables, and other procedures and functions, which must all be in that order.
This ordering requirement was originally intended to allow efficient single-pass compilation. However, in some dialects (such as Embarcadero Delphi) the strict ordering requirement of declaration sections has been relaxed.
Semicolons as statement separators
Pascal adopted many language syntax features from the
ALGOLALGOL is a family of imperative computer programming languages originally developed in the mid 1950s which greatly influenced many other languages and became the de facto way algorithms were described in textbooks and academic works for almost the next 30 years...
language, including the use of a semicolon as a statement separator. This is in contrast to other languages, such as
PL/IPL/I is a procedural, imperative computer programming language designed for scientific, engineering, business and systems programming applications...
,
CC is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
etc. which use the semicolon as a statement terminator. As illustrated in the above examples, no semicolon is needed before the
end keyword of a record type declaration, a block, or a
case statement; before the
until keyword of a repeat statement; and before the
else keyword of an
if statement.
The presence of an extra semicolon was not permitted in early versions of Pascal. However, the addition of
ALGOLALGOL is a family of imperative computer programming languages originally developed in the mid 1950s which greatly influenced many other languages and became the de facto way algorithms were described in textbooks and academic works for almost the next 30 years...
-like empty statements in the 1973
Revised Report and later changes to the language in ISO 7185:1983 now allow for optional semicolons in most of these cases. The exception is that a semicolon is still not permitted immediately before the
else keyword in an
if statement.
Compilers and interpreters
Several Pascal compilers and interpreters are available for the use of general public:
- Delphi is Embarcadero's (formerly Borland/CodeGear) flagship rapid application development
Rapid application development is a software development methodology that uses minimal planning in favor of rapid prototyping. The "planning" of software developed using RAD is interleaved with writing the software itself...
(RAD) product. It uses the Object Pascal language (termed 'Delphi' by Borland), descended from Pascal, to create applications for the windows platform. The .NET support that existed from D8 through D2005,D2006 and D2007 has been terminated, and replaced by a new language (Prism, which is rebranded Oxygene, see below) that is not fully backwards compatible. The most recent iteration of the win32 range (D2009) adds unicode and generics support.
- Free Pascal
Free Pascal Compiler is a free Pascal and Object Pascal compiler.In addition to its own Object Pascal dialect, Free Pascal supports, to varying degrees, the dialects of several other compilers, including those of Turbo Pascal, Delphi, and some historical Macintosh compilers...
is a multi-platform compiler written in Object PascalObject Pascal refers to a branch of object-oriented derivatives of Pascal, mostly known as the primary programming language of Embarcadero Delphi.-Early history at Apple:...
(and is self-hostingThe term self-hosting was coined to refer to the use of a computer program as part of the toolchain or operating system that produces new versions of that same program—for example, a compiler that can compile its own source code. Self-hosting software is commonplace on personal computers and larger...
). It is aimed at providing a convenient and powerful compiler, both able to compile legacy applications and to be the means of developing new ones. It is distributed under the GNU GPL, while packages and runtime library come under a modified GNU LGPLThe GNU Lesser General Public License or LGPL is a free software license published by the Free Software Foundation . It was designed as a compromise between the strong-copyleft GNU General Public License or GPL and permissive licenses such as the BSD licenses and the MIT License...
. Apart from compatibility modes for Turbo PascalTurbo Pascal is a software development system that includes a compiler and an integrated development environment for the Pascal programming language running on CP/M, CP/M-86, and DOS, developed by Borland under Philippe Kahn's leadership...
, Delphi and Mac Pascal, it also has its own procedural and object-oriented syntax modes with support for extended features such as operatorProgramming languages typically support a set of operators: operations which differ from the language's functions in calling syntax and/or argument passing mode. Common examples that differ by syntax are mathematical arithmetic operations, e.g...
overloading. It supports many platforms and operating systems.
- Lazarus
Lazarus is a free cross-platform IDE which provides a Delphi-like development experience for Pascal and Object Pascal developers. It is developed for, and supported by, the Free Pascal compiler. Since early 2008, Lazarus has been available for Microsoft Windows, several Linux distributions,...
is a Delphi-like visual cross-platform IDE for rapid application developmentRapid application development is a software development methodology that uses minimal planning in favor of rapid prototyping. The "planning" of software developed using RAD is interleaved with writing the software itself...
(RAD). Based on Free PascalFree Pascal Compiler is a free Pascal and Object Pascal compiler.In addition to its own Object Pascal dialect, Free Pascal supports, to varying degrees, the dialects of several other compilers, including those of Turbo Pascal, Delphi, and some historical Macintosh compilers...
, Lazarus is available for numerous platforms including LinuxLinux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
, FreeBSDFreeBSD is a free Unix-like operating system descended from AT&T UNIX via BSD UNIX. Although for legal reasons FreeBSD cannot be called “UNIX”, as the direct descendant of BSD UNIX , FreeBSD’s internals and system APIs are UNIX-compliant...
, Mac OS XMac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...
and Microsoft WindowsMicrosoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
.
- Dev-Pascal is a Pascal IDE
An integrated development environment is a software application that provides comprehensive facilities to computer programmers for software development...
that was designed in Borland DelphiObject Pascal refers to a branch of object-oriented derivatives of Pascal, mostly known as the primary programming language of Embarcadero Delphi.-Early history at Apple:...
and which supports Free Pascal and GNU Pascal as backends.
- Turbo51
Turbo51 is a compiler for the programming language Pascal, for the Intel MCS-51 family of microcontrollers. It features Borland Turbo Pascal 7 syntax, support for inline assembly code, source-level debugging, and optimizations, among others...
is a free Pascal compiler for the 8051 familyThe Intel MCS-51 is a Harvard architecture, single chip microcontroller series which was developed by Intel in 1980 for use in embedded systems. Intel's original versions were popular in the 1980s and early 1990s. While Intel no longer manufactures the MCS-51, binary compatible derivatives remain...
of microcontrollers, with Turbo PascalTurbo Pascal is a software development system that includes a compiler and an integrated development environment for the Pascal programming language running on CP/M, CP/M-86, and DOS, developed by Borland under Philippe Kahn's leadership...
7 syntax.
- Oxygene (formerly known as Chrome) is an Object Pascal compiler for the .NET
The .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...
and MonoMono, pronounced , is a free and open source project led by Xamarin to create an Ecma standard compliant .NET-compatible set of tools including, among others, a C# compiler and a Common Language Runtime....
platforms. It was created and is sold by RemObjects Software, and recently by Embarcadero as the backend compiler of PrismDelphi Prism is a rapid application development tool for the Microsoft .NET Framework and Mono, developed by RemObjects Software and distributed by Embarcadero Technologies....
.
- Kylix was a descendant of Delphi
Object Pascal refers to a branch of object-oriented derivatives of Pascal, mostly known as the primary programming language of Embarcadero Delphi.-Early history at Apple:...
, with support for the LinuxLinux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
operating system and an improved object library. It is no longer supported. Compiler and IDE are available now for non-commercial use.
- GNU Pascal
GNU Pascal is a Pascal compiler composed of a frontend to GNU Compiler Collection , similar to the way Fortran and other languages were added to GCC...
Compiler (GPC) is the Pascal compiler of the GNU Compiler CollectionThe GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...
(GCC). The compiler itself is written in C, the runtime library mostly in Pascal. Distributed under the GNU General Public LicenseThe GNU General Public License is the most widely used free software license, originally written by Richard Stallman for the GNU Project....
, it runs on many platforms and operating systems. It supports the ANSI/ISO standard languages and has partial Turbo Pascal dialect support. One of the more painful omissions is the absence of a 100% Turbo Pascal-compatible string type. Support for Borland Delphi and other language variations is quite limited, except maybe for Mac Pascal, the support for which is growing fast.
- DWScript aka DelphiWebScript, is an interpreter created by Matthias Ackermann and Hannes Hernler in 2000. Current version runs a dialect of Object Pascal largely compatible with Delphi, but also supports language constructs elements introduced in Prism.
- Dr. Pascal is an interpreter that runs Standard Pascal. Notable are the "visible execution" mode that shows a running program and its variables, and the extensive runtime error checking. Runs programs but does not emit a separate executable binary. Runs on DOS, Windows in DOS window, and old Macintosh.
- Dr. Pascal's Extended Pascal Compiler tested on DOS, Windows 3.1, 95, 98, NT.
- Virtual Pascal
Virtual Pascal is a free 32-bit Pascal compiler, IDE, and debugger for OS/2 and Microsoft Windows, with some limited Linux support. Although it had a wide user base in the late 1990s, VP has not evolved significantly for several years, and the owner declared in 2005 that development had ceased...
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. Development was canceled on April 4, 2005.
- P4 compiler, the basis for many subsequent Pascal-implemented-in-Pascal compilers, including the UCSD p-System. It implements a subset of full Pascal.
- P5 compiler, is an ISO 7185 (full Pascal) adaption of P4.
- Turbo Pascal
Turbo Pascal is a software development system that includes a compiler and an integrated development environment for the Pascal programming language running on CP/M, CP/M-86, and DOS, developed by Borland under Philippe Kahn's leadership...
was the dominant Pascal compiler for PCs during the 80s and early 90s, popular both because of its powerful extensions and extremely short compilation times. Turbo Pascal was compactly written and could compile, run, and debug all from memory without accessing disk. Slow floppy disk drives were common for programmers at the time, further magnifying Turbo Pascal's speed advantage. Currently, older versions of Turbo Pascal (up to 5.5) are available for free download from Borland's site.
- IP Pascal Implements the language "Pascaline" (named after Pascal's calculator), which is a highly extended Pascal compatible with original Pascal according to ISO 7185. It features modules with namespace control, including parallel tasking modules with semaphores, objects, dynamic arrays of any dimensions that are allocated at runtime, overloads, overrides, and many other extensions. 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.
- Pascal-XT was created by Siemens
Siemens may refer toSiemens, a German family name carried by generations of telecommunications industrialists, including:* Werner von Siemens , inventor, founder of Siemens AG...
for their mainframeMainframes are powerful computers used primarily by corporate and governmental organizations for critical applications, bulk data processing such as census, industry and consumer statistics, enterprise resource planning, and financial transaction processing.The term originally referred to the...
operating systems BS2000BS2000 is a mainframe computer operating system developed by Fujitsu Technology Solutions.Unlike other mainframe systems, BS2000/OSD provides exactly the same user and programming interface in all operating modes and regardless of whether it is running natively or as a guest system in a virtual...
and SINIXSINIX was a variant of the Unix operating system from Siemens Nixdorf Informationssysteme. Supersedes SIRM OS and Pyramid Technology's DC/OSx. Its last release under the SINIX name was version 5.43 in 1995...
.
- PocketStudio
PocketStudio by Winsoft is an IDE supporting rapid application development for Palm OS and related operating systems like Garnet OS or Access Linux Platform...
is a Pascal subset compiler and RAD tool for Palm OSPalm OS is a mobile operating system initially developed by Palm, Inc., for personal digital assistants in 1996. Palm OS is designed for ease of use with a touchscreen-based graphical user interface. It is provided with a suite of basic applications for personal information management...
and MC68xxx processors with some own extensions to assist interfacing with the Palm OS API. It resembles Delphi and Lazarus with a visual form designer, an object inspector and a source code editorA source code editor is a text editor program designed specifically for editing source code of computer programs by programmers. It may be a standalone application or it may be built into an integrated development environment ....
.
- MIDletPascal
MIDletPascal is an Pascal compiler and IDE specifically designed to create software for mobiles. It generates Java bytecode that runs on any Java ME device. In September 2009, Niksa Orlic, who wrote MIDlet pascal, transmitted the source code to the Russian Boolean.name development community for...
- A Pascal compiler and IDE that generates small and fast Java bytecode specifically designed to create software for mobiles
- Vector Pascal Vector Pascal is a language for SIMD
Single instruction, multiple data , is a class of parallel computers in Flynn's taxonomy. It describes computers with multiple processing elements that perform the same operation on multiple data simultaneously...
instruction sets such as the MMX and the AMD 3d Now, supporting all Intel and AMD processors, and Sony's PlayStation 2 Emotion Engine.
- Morfik Pascal allows the development of Web applications entirely written in Object Pascal (both server and browser side).
- WDSibyl - Visual Development Environment and Pascal compiler for Win32 and OS/2
- PP Compiler, a compiler for Palm OS that runs directly on the handheld computer
- CDC 6000 Pascal compiler The source code for the first (CDC 6000) Pascal compiler.
- Pascal-S - "Pascal-S: A Subset and Its Implementation", N. Wirth in Pascal - The Language and Its Implementation, by D.W. Barron, Wiley 1979.
- AmigaPascal - AmigaPascal, a free Pascal-Compiler for Amiga-Computer.
A very extensive list can be found on
Pascaland. The site is in French, but it is basically a list with URLs to compilers; there is little barrier for non-Francophones. The site,
Pascal Central, a Mac centric Pascal info and advocacy site with a rich collection of article archives, plus links to many compilers and tutorials, may also be of interest.
Standards
In 1983, the language was standardized, in the international standard IEC/ISO 7185, and several local country specific standards, including the American ANSI/IEEE770X3.97-1983, and ISO 7185:1983. These two standards differed only in that the ISO standard included a "level 1" extension for conformant arrays, where ANSI did not allow for this extension to the original (Wirth version) language. In 1989, ISO 7185 was revised (ISO 7185:1990) to correct various errors and ambiguities found in the original document.
In 1990, an extended Pascal standard was created as ISO/IEC 10206. In 1993 the ANSI standard was replaced by the ANSI organization with a "pointer" to the ISO 7185:1990 standard, effectively ending its status as a different standard.
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. This addition was made at the request of
C. A. R. HoareSir Charles Antony Richard Hoare , commonly known as Tony Hoare or C. A. R. Hoare, is a British computer scientist best known for the development of Quicksort, one of the world's most widely used sorting algorithms...
, and with the approval of Niklaus Wirth. The precipitating cause was that Hoare wanted to create a Pascal version of the
(NAG) Numerical Algorithms LibraryNAG Numerical Libraries is a software product sold by The Numerical Algorithms Group Ltd . The product is a software library of numerical analysis routines. It comprises a collection of 1500 mathematical and statistical algorithms. Areas covered include linear algebra, optimization, quadrature,...
, which had originally been written in FORTRAN, and found that it was not possible to do so without an extension that would allow array parameters of varying size. Similar considerations motivated the inclusion in ISO 7185 of the facility to specify the parameter types of procedural and functional parameters.
Note that Niklaus Wirth himself referred to the 1974 language as "the Standard", for example, to differentiate it from the machine specific features of the CDC 6000 compiler. This language was documented in
"The Pascal Report", the second part of the "Pascal users manual and report".
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.
The IBM-PC versions of the language began to differ with the advent of UCSD Pascal, an interpreted implementation that featured several extensions to the language, along with several omissions and changes. Many UCSD language features survive today, including in Borland's dialect.
Divisions
Niklaus Wirth's Zurich version of Pascal was issued outside of
ETHThe Swiss Federal Institute of Technology Zurich or ETH Zürich is an engineering, science, technology, mathematics and management university in the City of Zurich, Switzerland....
in two basic forms, the CDC 6000 compiler source, and a porting kit called Pascal-P system. The Pascal-P compiler left out several features of the full language. For example, procedures and functions used as parameters, undiscriminated variant records, packing, dispose, interprocedural gotos and other features of the full compiler were omitted.
UCSD PascalUCSD Pascal was a Pascal programming language system that ran on the UCSD p-System, a portable, highly machine-independent operating system. UCSD Pascal was first released in 1978...
, under Professor
Kenneth BowlesDr. Kenneth L "Ken" Bowles is best known for his work in initiating and directing the UCSD Pascal project, when he was a professor of Computer Science at the University of California, San Diego .- Education :Bowles received his PhD under Prof...
, was based on the Pascal-P2 kit, and consequently shared several of the Pascal-P language restrictions. UCSD Pascal was later adopted as Apple Pascal, and continued through several versions there. Although UCSD Pascal actually expanded the subset Pascal in the Pascal-P kit by adding back standard Pascal constructs, it was still not a complete standard installation of Pascal.
Borland's
Turbo PascalTurbo Pascal is a software development system that includes a compiler and an integrated development environment for the Pascal programming language running on CP/M, CP/M-86, and DOS, developed by Borland under Philippe Kahn's leadership...
, written by
Anders HejlsbergAnders Hejlsberg is a prominent Danish software engineer who co-designed several popular and commercially successful programming languages and development tools...
, was written in assembly language independent of UCSD or the Zurich compilers. However, it adopted much of the same subset and extensions as the UCSD compiler. This is probably because the UCSD system was the most common Pascal system suitable for developing applications on the resource-limited microprocessor systems available at that time.
List of related standards
- ISO 8651-2:1988 Information processing systems—Computer graphics—Graphical Kernel System (GKS) language bindings—Part 2: Pascal
Reception
Pascal generated a wide variety of responses in the computing community, both critical and complimentary.
Criticism
While very popular (although more so in the 1980s and early 1990s than now), implementations of Pascal which closely followed Wirth's initial definition of the language were widely criticized for being unsuitable for use outside of teaching.
Brian KernighanBrian Wilson Kernighan is a Canadian computer scientist who worked at Bell Labs alongside Unix creators Ken Thompson and Dennis Ritchie and contributed to the development of Unix. He is also coauthor of the AWK and AMPL programming languages. The 'K' of K&R C and the 'K' in AWK both stand for...
, who popularized the
C languageC is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
, outlined his most notable criticisms of Pascal as early as 1981, in his paper
Why Pascal Is Not My Favorite Programming Language. The most serious problem, described in this article, seems that array sizes and string lengths were part of the type so it was not possible to write a function that would accept variable length arrays or even strings as parameters (like a sorting library, for instance). The author also criticized the unpredictable order of evaluation of boolean expressions, poor library support, lack of static variables and a number of smaller issues. Also, he stated that the language did not provide any simple constructs to "escape" (knowingly and forcibly ignore) restrictions and limitations where this is really necessary. (However, there is a feature of "record variants" that does allow such an "escape," though it is decidedly cumbersome.) More general complaints from other sources noted that the scope of declarations were not clearly defined in the original language definition, which sometimes had serious consequences when using forward declarations to define pointer types, or when record declarations lead to mutual recursion, or when an identifier may or may not have been used in an enumeration list. Another difficulty was that, like
ALGOL 60ALGOL 60 is a member of the ALGOL family of computer programming languages. It gave rise to many other programming languages, including BCPL, B, Pascal, Simula, C, and many others. ALGOL 58 introduced code blocks and the begin and end pairs for delimiting them...
, the language did not allow procedures or functions passed as parameters to pre-define what their parameters are supposed to be.
On the other hand, many major development efforts in the 1980s, such as for the
Apple LisaThe Apple Lisa—also known as the Lisa—is a :personal computer designed by Apple Computer, Inc. during the early 1980s....
and Macintosh, heavily depended on Pascal (to the point where the C interface for the Macintosh operating system
APIAn application programming interface is a source code based specification intended to be used as an interface by software components to communicate with each other...
had to deal in Pascal data types).
Reactions
Pascal continued to evolve, and most of Kernighan's points do not apply to versions of the language which were enhanced to be suitable for commercial product development, such as Borland's
Turbo PascalTurbo Pascal is a software development system that includes a compiler and an integrated development environment for the Pascal programming language running on CP/M, CP/M-86, and DOS, developed by Borland under Philippe Kahn's leadership...
. Unfortunately, just as Kernighan predicted in his article, most of the extensions to fix these issues were incompatible from compiler to compiler. Since the early 1990s, however, the varieties seem to have condensed into two categories, ISO and Borland-like, a better eventual outcome than Kernighan foresaw.
Although Kernighan decried Pascal's lack of type escapes ("there is no escape" from "Why Pascal is not my Favorite Programming language"), the uncontrolled use of pointers and type escapes have become highly criticized features in their own right, and the languages
JavaJava is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
, C# and others feature a sharp turn-around to the Pascal point of view. What these languages call "managed pointers" were in fact foreseen by Wirth with the creation of Pascal.
Based on his experience with Pascal (and earlier with ALGOL)
Niklaus WirthNiklaus Emil Wirth is a Swiss computer scientist, best known for designing several programming languages, including Pascal, and for pioneering several classic topics in software engineering. In 1984 he won the Turing Award for developing a sequence of innovative computer languages.-Biography:Wirth...
developed several more programming languages:
ModulaThe Modula programming language is a descendent of the Pascal programming language. It was developed in Switzerland in the late 1970s by Niklaus Wirth, the same person who designed Pascal...
,
Modula-2Modula-2 is a computer programming language designed and developed between 1977 and 1980 by Niklaus Wirth at ETH Zurich as a revision of Pascal to serve as the sole programming language for the operating system and application software for the personal workstation Lilith...
,
OberonOberon is a programming language created in 1986 by Professor Niklaus Wirth and his associates at ETH Zurich in Switzerland. It was developed as part of the implementation of the Oberon operating system...
and Oberon-2. These languages address some criticisms of Pascal, are intended for different user populations, and so on, but none has had the widespread impact on computer science and computer users as has Pascal, nor has any yet met with similar commercial success.
See also
- Alphabetical list of programming languages
The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, in alphabetical order, except for dialects of BASIC and esoteric programming languages.- A :...
- ALGOL
ALGOL is a family of imperative computer programming languages originally developed in the mid 1950s which greatly influenced many other languages and became the de facto way algorithms were described in textbooks and academic works for almost the next 30 years...
- Ada (programming language)
Ada is a structured, statically typed, imperative, wide-spectrum, and object-oriented high-level computer programming language, extended from Pascal and other languages...
- Comparison of Pascal and Borland Delphi
This article is a comparison between Pascal and Delphi because Borland, the original manufacturer of Delphi, once used Delphi for their version of the Pascal-based programming language used in the product, which is otherwise known as Object Pascal...
- Embarcadero Delphi
- Lazarus (software)
Lazarus is a free cross-platform IDE which provides a Delphi-like development experience for Pascal and Object Pascal developers. It is developed for, and supported by, the Free Pascal compiler. Since early 2008, Lazarus has been available for Microsoft Windows, several Linux distributions,...
- Modula
The Modula programming language is a descendent of the Pascal programming language. It was developed in Switzerland in the late 1970s by Niklaus Wirth, the same person who designed Pascal...
- Oberon (programming language)
Oberon is a programming language created in 1986 by Professor Niklaus Wirth and his associates at ETH Zurich in Switzerland. It was developed as part of the implementation of the Oberon operating system...
- Object Pascal
Object Pascal refers to a branch of object-oriented derivatives of Pascal, mostly known as the primary programming language of Embarcadero Delphi.-Early history at Apple:...
- IP Pascal
IP Pascal is an implementation of the Pascal programming language using the IP portability platform, a multiple machine, operating system and language implementation system.- Overview :...
- Oxygene (programming language)
- Concurrent Pascal
Concurrent Pascal was designed by Per Brinch Hansen for writing concurrent computing programs such asoperating systems and real-time monitoring systems on shared memorycomputers....
- Comparison of Pascal and C
The computer programming languages C and Pascal have similar times of origin, influences, and purposes. Both were used to design their own compilers early in their lifetimes....
- C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
- Comparison of Pascal IDEs
- Real Programmers Don't Use Pascal
"Real Programmers Don't Use Pascal" is an essay about computer programming written by Ed Post of Tektronix, Inc., and published in July 1983 as a letter to the editor in Datamation....
Further reading
- Niklaus Wirth: The Programming Language Pascal. 35-63, Acta Informatica, Volume 1, 1971.
- C A R Hoare: Notes on data structuring. In O-J Dahl, E W Dijkstra and C A R Hoare, editors, Structured Programming, pages 83–174. Academic Press, 1972.
- C. A. R. Hoare, Niklaus Wirth: An Axiomatic Definition of the Programming Language Pascal. 335-355, Acta Informatica, Volume 2, 1973.
- Kathleen Jensen and Niklaus Wirth: PASCAL - User Manual and Report. Springer-Verlag, 1974, 1985, 1991, ISBN 0-387-97649-3 and ISBN 3-540-97649-3 http://www.cs.inf.ethz.ch/~wirth/books/Pascal/
- Niklaus Wirth: Algorithms + Data Structures = Programs. Prentice-Hall, 1975, ISBN 0-13-022418-9 http://www.cs.inf.ethz.ch/~wirth/books/AlgorithmE0/
- Niklaus Wirth: An assessment of the programming language PASCAL 23-30 ACM SIGPLAN Notices Volume 10, Issue 6, June 1975.
- N. Wirth, and A. I. Wasserman, ed: Programming Language Design. IEEE Computer Society Press, 1980
- D. W. Barron (Ed.): Pascal - The Language and its Implementation. John Wiley 1981, ISBN 0-471-27835-1
- Peter Grogono: Programming in Pascal, Revised Edition, Addison-Wesley, 1980
- Richard S. Forsyth: Pascal in Work and Play, Chapman and Hall, 1982
- N. Wirth, M. Broy, ed, and E. Denert, ed: Pascal and its Successors in Software Pioneers: Contributions to Software Engineering. Springer-Verlag, 2002, ISBN 3-540-43081-4
- N. Wirth: Recollections about the Development of Pascal. ACM SIGPLAN Notices, Volume 28, No 3, March 1993.
External links