Pascal is an imperative computer programming language, developed in 1970 by Niklaus Wirth as a language particularly suitable for structured programming.
Initially, Pascal was a language intended to teach students structured programming, and generations of students have "cut their teeth" on Pascal as an introductory language in undergraduate courses. Variants of Pascal are still widely used today, for example Free Pascal can be used in both 32 and 64 bit formats, and all types of Pascal programs can be used for both education and software development.
Parts of the original Macintosh operating system were written in Pascal and Motorola 68000 assembly language (though later versions incorporated substantial amounts of C++ as well), and the most frequent high-level language used for development in the early Mac community was Pascal. In addition, the popular typesetting system TeX was written by Donald E. Knuth in WEB, a variant of Pascal designed for literate programming.
The first successful port of the CDC Pascal compiler to another mainframe was completed by Welsh and Quinn at the Queen's University of Belfast in 1972. The target was the ICL 1900 computer.
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 that generated code for a "virtual" stack machine (i.e. code that lends itselt to reasonably efficient interpretation), along with an interpreter for that code - the p-code system. Although the p-code was primarily intended to be compiled into true machine code, at least one system, the notable UCSD implementation, utilized it to create an interpretive system UCSD p-System. The P-system compilers were termed P1-P4, with P1 being the first version, and P4 being the last.
Watcom Pascal was developed for the IBM mainframe in the early 1980s.
IP Pascal was an implementation of the Pascal programming language using 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. A reimplementation of this compiler for the IBM PC was marketed under the names Compas Pascal and PolyPascal before it was acquired by Borland. Renamed to Turbo Pascal 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 environments.
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.
Super Pascal was a variant which added non-numeric labels, a return statement and expressions as names of types.
With Turbo Pascal version 5.5 Borland added object orientation to Pascal. Around the same time a number of concepts were imported from C in order to let Pascal programmers use the C-based API of Microsoft Windows directly. These extensions included null-terminated strings, pointer arithmetic, function pointers, an address-of operator and unsafe typecasts.
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 still not a formal standard.) 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.
Turbo Pascal, and other derivatives with units or module concepts are modular languages. However, it does not provide a nested module concept or qualified import and export of specific symbols.
The universities of Zurich, Karlsruhe and Wuppertal have developed an EXtension for Scientific Computing (Pascal XSC) based on Oberon, which provides a free solution for programming numerical computations with controlled precision.
if, while, for, and related constructs.
Begin" and "End" keywords. Semicolons separate statements, and the full stop ends the program (or unit). Letter case is ignored in Pascal source.
here is an example of the source code in use for a very simple program:
program HelloWorld(output);
begin
writeln('Hello, World!')
end.
program myprog; var a: integer; b: char; c: boolean; d: (one, two, three, four, five);
A "subrange" of any of the above types can be made.
var x: 1..10; y: 'a'..'z'; z: two..four;
Types can be built from other types by the type declaration.
program myotherprog; type x = integer; y = x; ...
Further, complex types can be constructed from simple types:
type a = array * of integer; b = record a: integer; b: char end; c = file of a;
In Jensen & Wirth Pascal, strings are represented as packed arrays of chars; they therefore have fixed length and are usually space-padded. Later dialects commonly add a string type where the length of the contents can vary up to a declared maxiumum length. These are usually implemented by a length byte (limiting the maximum length to 255) and a fixed array of payload characters, and are therefore space-inefficient if the maximal length is seldom used in practice.
Here the variable pointer_to_b is a pointer to the data type b, a record. To create a new record and assign the values 10 and A to the fields a and b in the record, the commands would be; new(pointer_to_b); pointer_to_b^.a := 10; pointer_to_b^.b := 'A'; pointer_to_b^.c := nil; ... Linked lists can be created by including a pointer type field (c) in the record (see also nil and null (computer)).
while a <> b do writeln('Waiting'); if a > b then writeln('Condition met') else writeln('Condition false'); for i := 1 to 10 do writeln('Iteration: ', i:1); repeat a := a + 1 until a = 10;
program mine(output); var i : integer; procedure print(var j: integer); function next(k: integer): integer; begin next := k + 1 end; begin writeln('The total is: ', j); j := next(j) end; begin i := 1; while i <= 10 do print(i) end.
Procedures and functions can nest to any depth, and the 'program' construct is the logical outermost block.
Each block 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 most modern dialects the strict ordering requirement of declaration sections has been abandoned.
A very extensive list can be found on Pascaland. 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, a Mac centric Pascal info and advocacy site with a rich collection of article archives, plus links to many compilers and tutorials.
The ISO 7185 was stated to be a clarification of Wirth's 1974 language as detailed by the User Manual and Report 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.
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.
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.
UCSD Pascal, under professor Kenneth Bowles, used the Pascal-P2 kit, and consequentially had several of the same differences with the full Zurich Pascal compiler as the Pascal-P compiler did. UCSD Pascal later was adopted as Apple Pascal, and continued through several versions there.
Borland's Turbo Pascal, written by Anders Hejlsberg was written in assembly language independent of UCSD or the Zurich compilers. However, it adopted much of the same subset as the UCSD compiler, probably because at that time, UCSD was the most common Pascal system running on Microprocessors.
In the decades since then, Pascal has continued to evolve and most of Kernighan's points do not apply to current implementations. Unfortunately, just as Kernighan predicted in his article, most of the extensions to fix these issues were incompatible from compiler to compiler. In the last decade, however, the varieties seem to have condensed into two categories, ISO or Borland like, a better eventual outcome than Kernighan foresaw.
Based on his experience with Pascal Niklaus Wirth developed two more programming languages: Modula-2 and Oberon. Although these languages are an improvement upon Pascal, they have yet to meet with the same commercial success.
Algol programming language family | Imperative programming languages | Pascal | Procedural programming languages | Statically-typed programming languages | Structured programming languages
باسكال (برمجة) | Lenguache de programazión Pascal | Pascal | Паскал (език) | Pascal (programovací jazyk) | Pascal (programmeringssprog) | Pascal (Programmiersprache) | Pascal | Lenguaje de programación Pascal | Paskalo (programlingvo) | Pascal programazio lengoaia | زبان برنامهنویسی پاسکال | Pascal (langage) | Linguaxe Pascal | 파스칼 프로그래밍 언어 | Pascal (programski jezik) | Pascal (bahasa pemrograman) | Pascal (linguaggio) | פסקל (שפת תכנות) | Pascal | Pascal | Pascal programozási nyelv | Паскал | Pascal (programmeertaal) | Pascal | Pascal (język programowania) | Pascal (linguagem de programação) | Limbajul Pascal | Паскаль (язык программирования) | Pascal (programovací jazyk) | Programski jezik pascal | Програмски језик Паскал | Pascal (programski jezik) | Pascal (ohjelmointikieli) | Pascal (programspråk) | Pascal (programming language) | ภาษาปาสกาล | Pascal (ngôn ngữ lập trình) | Pascal programlama dili | Pascal (мова програмування) | Pascal
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Pascal programming language".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world