Hubbry Logo
Pascal (programming language)Pascal (programming language)Main
Open search
Pascal (programming language)
Community hub
Pascal (programming language)
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Pascal (programming language)
Pascal (programming language)
from Wikipedia
Pascal
Paradigm
FamilyWirth Pascal
Designed byNiklaus Wirth
First appeared1970; 55 years ago (1970)
Typing discipline
ScopeLexical
Filename extensions.pas
Major implementations
Dialects
Influenced by
Influenced
  • Pascal Programming at Wikibooks

Pascal is an imperative and procedural programming language, designed by Niklaus Wirth as a small, efficient language intended to encourage good programming practices using structured programming and data structuring. It is named after French mathematician, philosopher and physicist Blaise Pascal.[a]

Pascal was developed on the pattern of the ALGOL 60 language. Wirth was involved in the process to improve the language as part of the ALGOL X efforts and proposed a version named ALGOL W. This was not accepted, and the ALGOL X process bogged down. In 1968, Wirth decided to abandon the ALGOL X process and further improve ALGOL W, releasing this as Pascal in 1970.

On top of ALGOL's scalars and arrays, Pascal enables defining complex datatypes and building dynamic and recursive data structures such as lists, trees and graphs. Pascal has strong typing on all objects, which means that one type of data cannot be converted to or interpreted as another without explicit conversions. Unlike C (and also unlike most other languages in the C-family), Pascal allows nested procedure definitions to any level of depth, and also allows most kinds of definitions and declarations inside subroutines (procedures and functions). A program is thus syntactically similar to a single procedure or function. This is similar to the block structure of ALGOL 60, but restricted from arbitrary block statements to just procedures and functions.

Pascal became very successful in the 1970s, notably on the burgeoning minicomputer market. Compilers were also available for many microcomputers as the field emerged in the late 1970s. It was widely used as a teaching language in university-level programming courses in the 1980s, and also used in production settings for writing commercial software during the same period. It was displaced by the C programming language during the late 1980s and early 1990s as UNIX-based systems became popular, and especially with the release of C++.

A derivative named Object Pascal designed for object-oriented programming was developed in 1985. This was used by Apple Computer (for the Lisa and Macintosh machines) and Borland in the late 1980s and later developed into Delphi on the Microsoft Windows platform. Extensions to the Pascal concepts led to the languages Modula-2 and Oberon, both developed by Wirth.

History

[edit]

Earlier efforts

[edit]

Much of the history of computer language design during the 1960s can be traced to the ALGOL 60 language. ALGOL was developed during the 1950s with the explicit goal of being able to clearly describe algorithms. It included a number of features for structured programming that remain common in languages to this day.

Shortly after its introduction, in 1962 Wirth began working on his dissertation with Helmut Weber on the Euler programming language. Euler was based on ALGOL's syntax and many concepts but was not a derivative. Its primary goal was to add dynamic lists and types, allowing it to be used in roles similar to Lisp. The language was published in 1965.

By this time, a number of problems in ALGOL had been identified, notably the lack of a standardized string system. The group tasked with maintaining the language had begun the ALGOL X process to identify improvements, calling for submissions. Wirth and Tony Hoare submitted a conservative set of modifications to add strings and clean up some of the syntax. These were considered too minor to be worth using as the new standard ALGOL, so Wirth wrote a compiler for the language, which became named ALGOL W.

The ALGOL X efforts would go on to choose a much more complex language, ALGOL 68. The complexity of this language led to considerable difficulty producing high-performance compilers, and it was not widely used in the industry. This left an opening for newer languages.

Pascal

[edit]

Pascal was influenced by the ALGOL W efforts, with the explicit goals of teaching programming in a structured fashion and for the development of system software.[5] A generation of students used Pascal as an introductory language in undergraduate courses. Other goals included providing a reliable and efficient tool for writing large programs,[6] and bridging the canyon between scientific and commercial programming, as represented by the then-widespread languages Fortran and COBOL, with a general-purpose language.[7]

One of the early successes for the language was the introduction of UCSD Pascal, a version that ran on a custom operating system that could be ported to different platforms. A key platform was the Apple II, where it saw widespread use as Apple Pascal. This led to Pascal becoming the primary high-level language used for development in the Apple Lisa, and later, the Macintosh. Parts of the original Macintosh operating system were hand-translated into Motorola 68000 assembly language from the Pascal source code.[8]

The typesetting system TeX by Donald Knuth was written in WEB, the original literate programming system, based on DEC PDP-10 Pascal. Successful commercial applications like Adobe Photoshop[9] were written in Macintosh Programmer's Workshop Pascal, while applications like Total Commander, Skype[10] and Macromedia Captivate were written in Delphi (Object Pascal). Apollo Computer used Pascal as the systems programming language for its operating systems beginning in 1980.

Variants of Pascal have also been used for everything from research projects to PC games and embedded systems. Newer Pascal compilers exist which are widely used.[11]

Dialects

[edit]

Wirth's example compiler meant to propagate the language, the Pascal-P system, used a subset of the language designed to be the minimal subset of the language that could compile itself. The idea was that this could allow bootstrapping the compiler, which would then be extended to full Pascal language status. This was done with several compilers, but one notable exception was UCSD Pascal, which was based on Pascal-P2. It kept the subset status of the language based on the idea that this would run better on the new (then) microprocessors with limited memory. UCSD also converted the Pascal-P2 interpreter into a "byte machine", again, because it would be a better fit for byte oriented microprocessors.

UCSD Pascal formed the basis of many systems, including Apple Pascal. Borland Pascal was not based on the UCSD codebase, but arrived during the popular period of UCSD and matched many of its features. This started the line that ended with Delphi Pascal and the compatible Open Source compiler FPC/Lazarus.

The ISO standard for Pascal, ISO 7185, was published in 1983 and was widely implemented and used on mainframes, minicomputers and IBM-PCs and compatibles from 16 bits to 32 bits. The two dialects of Pascal most in use towards the end of the 20th century and up until today are the ISO 7185 standard version and the Delphi/Turbo Pascal versions (of which the two Borland versions are mostly compatible with each other).

The source for much of the early history on Pascal can be found in the Pascal User's Group newsletters at:

Pascal Users Group Newsletters.

Object Pascal

[edit]

During work on the Lisa, Larry Tesler began corresponding with Wirth on the idea of adding object-oriented extensions to the language, to make Pascal a multi-paradigm programming language. This led initially to Clascal, introduced in 1983. As the Lisa program faded and was replaced by the Macintosh, a further version was created and named Object Pascal. This was introduced on the Mac in 1985 as part of the MacApp application framework, and became Apple's main development language into the early 1990s.

The Object Pascal extensions were added to Turbo Pascal with the release of version 5.5 in 1989.[12] Over the years, Object Pascal became the basis of the Delphi system for Microsoft Windows, which is still used for developing Windows applications, and can cross-compile code to other systems. Free Pascal is an open source, cross-platform alternative with its own graphical IDE called Lazarus.

Implementations

[edit]

Early compilers

[edit]

The first Pascal compiler was designed in Zürich for the CDC 6000 series mainframe computer family. Niklaus Wirth reports that a first attempt to implement it in FORTRAN 66 in 1969 was unsuccessful due to FORTRAN 66's inadequacy to express complex data structures. The second attempt was implemented in a C-like language (Scallop by Max Engeli) and then translated by hand (by R. Schild) to Pascal itself for boot-strapping.[13] It was operational by mid-1970. Many Pascal compilers since have been similarly self-hosting, 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 ported to a new environment. The GNU Pascal 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 Queen's University of Belfast (QUB) in 1972. The target was the International Computers Limited (ICL) 1900 series. This compiler, in turn, was the parent of the Pascal compiler for the Information Computer Systems (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 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. Microsoft had Pascal compilers for IBM PCs, see Microsoft Pascal.

The Pascal-P system

[edit]

To propagate the language rapidly, a compiler porting kit was created in Zürich that included a compiler that generated so called p-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 named Pascal-P1, Pascal-P2, Pascal-P3, and Pascal-P4. Pascal-P1 was the first version, and Pascal-P4 was the last to come from Zürich. The version termed Pascal-P1 was coined after the fact for the many different sources for Pascal-P that existed. The compiler was redesigned to enhance portability, and issued as Pascal-P2. This code was later enhanced to become Pascal-P3, with an intermediate code backward compatible with Pascal-P2, and Pascal-P4, which was not backward compatible.

The Pascal-P4 compiler–interpreter can still be run and compiled on systems compatible with original Pascal (as can Pascal-P2). However, it only accepts a subset of the Pascal language.

Pascal-P5, created outside the Zürich group, accepts the full Pascal language and includes ISO 7185 compatibility.

Pascal-P6 is a follow on to Pascal-P5 that along with other features, aims to be a compiler for specific CPUs, including AMD64.

UCSD Pascal branched off Pascal-P2, where Kenneth Bowles used it to create the interpretive UCSD p-System. It was one of three operating systems available at the launch of the original IBM Personal Computer.[14] UCSD Pascal used an intermediate code based on byte values, and thus was one of the earliest bytecode compilers. Apple Pascal was released in 1979 for the Apple II and Apple III computer systems. It was an implementation of, or largely based on, UCSD Pascal. Pascal-P1 through Pascal-P4 were not, but rather based on the CDC 6600 60-bit word length.

A compiler based on the Pascal-P4 compiler, which created native binary object files, was released for the IBM System/370 mainframe computer by the Australian Atomic Energy Commission; it was named the AAEC Pascal 8000 Compiler after the abbreviation of the name of the commission.[15]

Object Pascal and Turbo Pascal

[edit]

Apple Computer created its own Lisa Pascal for the Lisa Workshop in 1982, and ported the compiler to the Apple Macintosh and MPW 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 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 and renamed Turbo Pascal.

Turbo Pascal became hugely popular, thanks to an aggressive pricing strategy, having one of the first full-screen IDEs, and very fast turnaround time (just seconds to compile, link, and run). It was written and highly optimized entirely in assembly language, making it smaller 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 Microsoft also implemented the Object Pascal compiler.[16][17] 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 BASIC used this product. It also began to be adopted by professional developers. Around the same time a number of concepts were imported from C to let Pascal programmers use the C-based application programming interface (API) of Microsoft Windows directly. These extensions included null-terminated strings, pointer arithmetic, function pointers, an address-of operator, and unsafe typecasts.

Turbo Pascal and other derivatives with unit or module structures are modular programming languages. However, it does not provide a nested module concept or qualified import and export of specific symbols.

Other variants

[edit]

Super Pascal adds non-numeric labels, a return statement and expressions as names of types.

TMT Pascal was the first Borland-compatible compiler for 32-bit MS-DOS compatible protected mode, OS/2, and Win32. It extends the language with function and operator overloading.

The universities of Wisconsin–Madison, Zürich, Karlsruhe, and Wuppertal developed the Pascal-SC[18][19] and Pascal-XSC[20][21][22] (Extensions for Scientific Computation) compilers, aimed at programming numerical computations. Development for Pascal-SC started in 1978 supporting ISO 7185 Pascal level 0, but level 2 support was added at a later stage.[23] Pascal-SC originally targeted the Z80 processor, but was later rewritten for DOS (x86) and 68000. Pascal-XSC has at various times been ported to Unix (Linux, SunOS, HP-UX, AIX) and Microsoft/IBM (DOS with EMX, OS/2, Windows) operating systems. It operates by generating intermediate C source code which is then compiled to a native executable. Some of the Pascal-SC language extensions have been adopted by GNU Pascal.

Pascal Sol was designed around 1983 by a French team to implement a Unix-like system named Sol. It was standard Pascal level-1 (with parameterized array bounds) but the definition allowed alternative keywords and predefined identifiers in French and the language included a few extensions to ease system programming (e.g. an equivalent to lseek).[24] The Sol team later on moved to the ChorusOS project to design a distributed operating system.[25]

IP Pascal is an implementation of the Pascal programming language using Micropolis DOS, but was moved rapidly to CP/M-80 running on the Z80. 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 arrays, and many other extensions, and generally features the same functionality and type protection as C#. It is the only such implementation that is also compatible with the original Pascal implementation, which is standardized as ISO 7185.

Language constructs

[edit]

Pascal, in its original form, is a purely procedural language and includes the traditional array of ALGOL-like control structures with reserved words such as if, then, else, while, for, and case, ranging on a single statement or a begin-end statements block. Pascal also has data structuring constructs not included in the original ALGOL 60 types, like records, variants, pointers, enumerations, and sets and procedure pointers. Such constructs were in part inherited or inspired from Simula 67, ALGOL 68, Niklaus Wirth's own ALGOL W and suggestions by C. A. R. Hoare.

Pascal programs start with the program keyword with a list of external file descriptors as parameters[26] (not required in Turbo Pascal etc.); then follows the main block bracketed by the begin and end keywords. Semicolons separate statements, and the full stop (i.e., a period) ends the whole program (or unit). Letter case 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!')
    {No ";" is required after the last statement of a block -
        adding one adds a "null statement" to the program, which is ignored by the compiler.}
end.

Data types

[edit]

A Type Declaration in Pascal is used to define a range of values which a variable of that type is capable of storing. 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 integer (whole) numbers
real floating-point numbers
Boolean the values True or False
char a single character from an ordered character set
set equivalent to an array of Boolean values
array a countable group of any of the preceding data types, of records, or of other arrays
record A collection of any of the preceding data types or of other records
string a sequence or "string" of characters is declared as a "packed array of char" with a starting index of 1. These can be assigned string constants and individual characters can be accessed as elements of the array.

The range of values allowed for the basic types (except Boolean) is implementation defined. Functions are provided for some data conversions. For conversion of real to integer, the following functions are available: round (using rounding half away from zero) and trunc (rounds 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, for example

type
    byte        = 0..255;
    signed_byte = -128..127;
    string      = packed array[1..255] of char;

Often-used types like byte and string are already defined in many implementations.

Normally the system will use a word to store the data. For instance, the byte type may be stored in a machine integer - 32 bits perhaps - rather than an 8-bit value. Pascal does not contain language elements that allow the basic storage types to be defined more granularly. This capability was included in a number of Pascal extensions and follow-on languages, while others, like Modula-2, expanded the built-in set to cover most machine data types like 16-bit integers.

The packed keyword tells the compiler to use the most efficient method of storage for the structured data types: sets, arrays and records, rather than using one word for each element. Packing may slow access on machines that do not offer easy access to parts of a word.

Subrange types

[edit]

Subranges of any ordinal data type (any simple type except real) can also be made:

var
    x : 1..10;
    y : 'a'..'z';

Set types

[edit]

In contrast with other programming languages from its time, Pascal supports a set type:[27]

var
    Set1 : set of 1..10;
    Set2 : set of 'a'..'z';

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 bit vectors. The set operators can then be implemented efficiently as bitwise machine code operations.

Record types

[edit]

An example of a Pascal record type:

type
     car = record
         length: integer;
         width: integer
     end;

An example of a variant record type:

type
     Shape = (Circle, Square, Triangle);
     Dimensions = record
        case Figure: Shape of 
           Circle: (Diameter: real);
           Square: (Width: real);
           Triangle: (Side: real; Angle1, Angle2: 0..360)
        end;

Variant records allow several fields of the record to overlap each other to save space.

Type declarations

[edit]

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  {extra semicolon not strictly required}
    end;
    c = file of a;

Further, complex types can be constructed from other complex types recursively:

const
  Jack  = 11;
  Queen = 12;
  King  = 13;
  Ace   = 14;

type		   
  valueType = 2..Ace;             
  suitType  = club, diamond, heart, spade;

  cardType  = record
                suit:   suitType; 
                value:  valueType;
              end;

  deckType = array [1..52] of cardType;

  person = record
             surname: packed array [1..20] of char; 
			 age: integer;
		   end;

  table = record 
            hands: array [1..3] of deckType;
			players: array [1..4] of person;
          end;

File type

[edit]
type
    a = file of integer;
    b = record
        x : integer;
        y : char
    end;
    c = file of b;

As shown in the example above, Pascal files 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, which waits until the file buffer variable is actually accessed before performing file operations.

Pointer types

[edit]

Pascal supports the use of pointers:

type
    pNode = ^Node;
    Node  = record
        a : integer;
        b : char;
        c : pNode  
    end;
var
    NodePtr : pNode;
    IntPtr  : ^integer;

Here the variable NodePtr 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 the null pointer ("NIL" in Pascal), the statements would be:

new(NodePtr);
...
NodePtr^.a := 10;
NodePtr^.b := 'A';
NodePtr^.c := nil;
...

This could also be done using the with statement, as follows:

new(NodePtr);
...
with NodePtr^ 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 NodePtr and not to the record Node or the pointer type pNode.

Linked lists, stacks and queues can be created by including a pointer type field (c) in the record.

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/I or C. It also removes some risks caused by dangling pointers, but the ability to dynamically deallocate referenced space by using the dispose function (which has the same effect as the free library function found in C) means that the risk of dangling pointers has not been eliminated[28] as it has in languages such as Java and C#, which provide automatic garbage collection (but which do not eliminate the related problem of memory leaks).

Some of these restrictions can be lifted in newer dialects.

Control structures

[edit]

Pascal is a structured programming language, meaning that the flow of control is structured into standard statements, usually without 'goto' commands.

while a <> b do  WriteLn('Waiting');

if a > b then WriteLn('Condition met')   {no semicolon allowed before else}
    else WriteLn('Condition not met');

for i := 1 to 10 do  {no semicolon here as it would detach the next statement}
    WriteLn('Iteration: ', i);

repeat
    a := a + 1
until a = 10;

case i of
    0 : Write('zero');
    1 : Write('one');
    2 : Write('two');
    3,4,5,6,7,8,9,10: Write('?')
end;

Procedures and functions

[edit]

Pascal structures programs into procedures and functions. Generally, a procedure is used for its side effects, whereas a function is used for its return value.

program Printing(output);

var i : integer;

procedure PrintAnInteger(j : integer);
begin
    ...
end;

function triple(x: integer): integer;
begin
	triple := x * 3
end;

begin { main program }
    ...
    PrintAnInteger(i);
    PrintAnInteger(triple(i))
end.

Procedures and functions can be nested to any depth, and the 'program' construct is the logical outermost block.

By default, parameters are passed by value. If 'var' precedes a parameter's name, it is passed by reference.

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 Delphi) the strict ordering requirement of declaration sections has been relaxed.

Semicolons as statement separators

[edit]

Pascal adopted many language syntax features from the ALGOL language, including the use of a semicolon as a statement separator. This is in contrast to other languages, such as PL/I and C, which use the semicolon as a statement terminator. 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 ALGOL-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. A semicolon is still not permitted immediately before the else keyword in an if statement, because the else follows a single statement, not a statement sequence. In the case of nested ifs, a semicolon cannot be used to avoid the dangling else problem (where the inner if does not have an else, but the outer if does) by putatively terminating the nested if with a semicolon – this instead terminates both if clauses. Instead, an explicit begin...end block must be used.[29]

Resources

[edit]

Compilers and interpreters

[edit]

Several Pascal compilers and interpreters are available for general use:

  • Delphi is Embarcadero's (formerly Borland/CodeGear) flagship rapid application development (RAD) product. It uses the Object Pascal language (termed 'Delphi' by Borland), descended from Pascal, to create applications for Windows, macOS, iOS, and Android. 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 backward compatible. In recent years Unicode support and generics were added (D2009, D2010, Delphi XE).
  • Free Pascal is a cross-platform compiler written in Object Pascal (and is self-hosting). It is aimed at providing a convenient and powerful compiler, both able to compile legacy applications and to be the means to develop new ones. It is distributed under the GNU General Public License (GNU GPL), while packages and runtime library come under a modified GNU Lesser General Public License (GNU LGPL). In addition to compatibility modes for Turbo Pascal, Delphi, and Mac Pascal, it has its own procedural and object-oriented syntax modes with support for extended features such as operator overloading. It supports many platforms and operating systems. Current versions also feature an ISO mode.
  • Turbo51 is a free Pascal compiler for the Intel 8051 family of microcontrollers, with Turbo Pascal 7 syntax.
  • Oxygene (formerly named Chrome) is an Object Pascal compiler for the .NET and Mono platforms. It was created and is sold by RemObjects Software, and sold for a while by Embarcadero as the backend compiler of Prism.
  • Kylix was a descendant of Delphi, with support for the Linux operating system and an improved object library. It is no longer supported. Compiler and IDE are available now for non-commercial use.
  • GNU Pascal Compiler (GPC) is the Pascal compiler of the GNU Compiler Collection (GCC). The compiler is written in C, the runtime library mostly in Pascal. Distributed under the GNU General Public License, 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 notable omissions is the absence of a fully Turbo Pascal-compatible (short)string type. Support for Borland Delphi and other language variants is quite limited. There is some support for Mac-pascal, however.
  • Virtual Pascal 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.
  • Pascal-P4 compiler, the basis for many subsequent Pascal-implemented-in-Pascal compilers. It implements a subset of full Pascal.
  • Pascal-P5 compiler is an ISO 7185 (full Pascal) adaption of Pascal-P4.
  • Pascal-P6 compiler is an extended version of Pascal adaption of Pascal-P5 according to the Pascaline language specification.
  • Smart Mobile Studio is a Pascal to HTML5/JavaScript compiler
  • Turbo Pascal was the dominant Pascal compiler for PCs during the 1980s and early 1990s, 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 for their mainframe operating systems BS2000 and SINIX.
  • PocketStudio is a Pascal subset compiler and RAD tool for Palm OS and MC68xxx processors with some of its 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 editor.
  • MIDletPascal – A Pascal compiler and IDE that generates small and fast Java bytecode specifically designed to create software for mobiles.
  • Vector Pascal is a language for SIMD 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 is the source code for the first (CDC 6000) Pascal compiler.
  • Pascal-S[30]
  • AmigaPascal is a free Pascal compiler for Amiga systems.
  • VSI Pascal for OpenVMS (formerly HP Pascal for OpenVMS, Compaq Pascal, DEC Pascal, VAX Pascal and originally VAX-11 Pascal[31]) is a Pascal compiler that runs on OpenVMS systems.[32] It was also supported under Tru64.[33][34] VSI Pascal for OpenVMS is compatible with ISO/IEC 7185:1990 Pascal as well some of ISO/IEC 10206:1990 Extended Pascal, and also includes its own extensions.[32] The compiler frontend is implemented in BLISS.[35]
  • Stony Brook Pascal+ was a 16-bit (later 32-bit) optimizing compiler for DOS and OS/2, marketed as a direct replacement for Turbo Pascal, but producing code that executed at least twice as fast.

IDEs

[edit]

Libraries

[edit]
  • WOL Library for creating GUI applications with the Free Pascal Compiler.

Standards

[edit]

ISO/IEC 7185:1990 Pascal

[edit]

In 1983, the language was standardized in the international standard IEC/ISO 7185[36] 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 (an array where the boundaries of the array are not known until run time), 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.

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. Hoare, and with the approval of Niklaus Wirth. The precipitating cause was that Hoare wanted to create a Pascal version of the (NAG) Numerical Algorithms Library, 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.

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,[37] 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.

ISO/IEC 10206:1990 Extended Pascal

[edit]

In 1990, an extended Pascal standard was created as ISO/IEC 10206,[38] which is identical in technical content[39] to IEEE/ANSI 770X3.160-1989[40] As of 2019, Support of Extended Pascal in FreePascal Compiler is planned.[41]

Variations

[edit]

Niklaus Wirth's Zürich version of Pascal was issued outside ETH 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 that were not required to bootstrap the compiler. 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 Pascal, under Professor Kenneth Bowles, 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.

In the early 1990s, Alan Burns and Geoff Davies developed Pascal-FC, an extension to Pl/0 (from the Niklaus' book Algorithms + Data Structures = Programs). Several constructs were added to use Pascal-FC as a teaching tool for Concurrent Programming (such as semaphores, monitors, channels, remote-invocation and resources). To be able to demonstrate concurrency, the compiler output (a kind of P-code) could then be executed on a virtual machine. This virtual machine not only simulated a normal – fair – environment, but could also simulate extreme conditions (unfair mode).

Borland-like Pascal compilers

[edit]

Borland's Turbo Pascal, written by Anders Hejlsberg, was written in assembly language independent of UCSD and the Zürich 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.

The shrink-wrapped Turbo Pascal version 3 and later incarnations, including Borland's Object Pascal and Delphi and non-Borland near-compatibles became popular with programmers including shareware authors, and so the SWAG library of Pascal code features a large amount of code written with such versions as Delphi in mind.

Software products (compilers, and IDE/Rapid Application Development (RAD)) in this category:

  • Turbo Pascal – "TURBO.EXE" up to version 7, and Turbo Pascal for Windows ("TPW") and Turbo Pascal for Macintosh.
  • Pure Pascal and HiSPeed Pascal 2 Pascal language Environment for the Atari ST range of computers.
  • Borland Pascal 7 – A professional version of Turbo Pascal line which targeted both DOS and Windows.
  • Object Pascal – an extension of the Pascal language that was developed at Apple Computer by a team led by Larry Tesler in consultation with Niklaus Wirth, the inventor of Pascal; its features were added to Borland's Turbo Pascal for Macintosh and in 1989 for Turbo Pascal 5.5 for DOS.
  • Delphi – Object Pascal is essentially its underlying language.
  • Free Pascal compiler (FPC) – Free Pascal adopted the standard dialect of Borland Pascal programmers, Borland Turbo Pascal and, later, Delphi.
  • PascalABC.NET – a new generation Pascal programming language including compiler and IDE.
  • Borland Kylix is a compiler and IDE formerly sold by Borland, but later discontinued. It is a Linux version of the Borland Delphi software development environment and C++Builder.
  • Lazarus – similar to Kylix in function, is a free cross-platform visual IDE for RAD using the Free Pascal compiler, which supports dialects of Object Pascal to varying degrees.
  • Virtual Pascal – VP2/1 is a fully Borland Pascal– and Borland Delphi–compatible 32-bit Pascal compiler for OS/2 and Windows 32 (with a Linux version "on the way").[42]
  • Sybil is an open source Delphi-like IDE and compiler; implementations include:
    • WDSibyl[43] for Microsoft Windows and OS/2, a commercial Borland Pascal compatible environment released by a company named Speedsoft that was later developed into a Delphi-like rapid application development (RAD) environment named Sybil and then open sourced under the GPL when that company closed down;
    • Open Sybil, which is an ongoing project, an open source tool for OS/2 and eCS that was originally based on Speedsoft's WDsybl Sibyl Portable Component Classes (SPCC) and Sibyl Visual Development Tool (SVDE) sources, but now its core is IBM System Object Model (SOM), WPS and OpenDoc.[44]
[edit]
  • ISO 8651-2:1988 Information processing systems – Computer graphics – Graphical Kernel System (GKS) language bindings – Part 2: Pascal

Reception

[edit]

Pascal generated a wide variety of responses in the computing community, both critical and complimentary.

Early criticism

[edit]

Wirth's initial definition of the language was widely criticized. In particular, Nico Habermann commented in his "Critical Comments on the Programming Language Pascal" (1973) that many of its constructs were poorly defined, in particular for data types, ranges, structures, and goto.[45] Later, Brian Kernighan, who popularized the C language, outlined his criticisms of Pascal in 1981 in his article "Why Pascal is Not My Favorite Programming Language".[46] The most serious problem Kernighan described was 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. This made it unfeasible to write, for example, a sorting library. Kernighan also criticized the unpredictable order of evaluation of Boolean expressions, poor library support, and lack of static variables, and raised 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. More general complaints from other sources[28][47] noted that the scope of declarations was 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 led to mutual recursion, or when an identifier may or may not have been used in an enumeration list. Another difficulty was that, like ALGOL 60, the language did not allow procedures or functions passed as parameters to predefine the expected type of their parameters.

Rising popularity in the 1970s and 1980s

[edit]

In the two decades after 1975, Pascal gained increasing attention and became a major programming language for important platforms (including Apple II, Apple III, Apple Lisa, Commodore systems, Z-80-based machines and IBM PC) due to the availability of UCSD Pascal and Turbo Pascal.[48]

Despite initial criticisms, 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 Pascal. 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, most of the varieties seem condensed into two categories: ISO and Borland-like. Extended Pascal addresses many of these early criticisms. It supports variable-length strings, variable initialization, separate compilation, short-circuit Boolean operators, and default (otherwise) clauses for case statements.[49]

Some of the problems arising from the differences in the implementations of Pascal were later partly solved by the advent of Free Pascal, which supports several dialects with mode directives.[50]

Notes

[edit]

See also

[edit]

References

[edit]

Further reading

[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
Pascal is a procedural, language developed in 1970 by Swiss computer scientist at , , with the primary goal of promoting practices and serving as an educational tool for teaching programming concepts. Named after the 17th-century French mathematician and philosopher , the language was designed in 1968–1969 as a response to the emerging "" and limitations in existing languages like and , drawing heavily from and . Its first compiler became operational in early 1970, and the language definition was published that same year, quickly gaining adoption for introductory courses due to its emphasis on clarity, efficiency, and well-organized code. Key features of Pascal include strong static typing, which requires variables to be declared with specific types before use, helping to prevent type-related errors at ; built-in data types such as , real, char, , and support for user-defined types like records and arrays; and control structures including , case, while-do, repeat-until, and for loops that facilitate structured and discourage reliance on unstructured elements like statements. The language supports through procedures and functions, recursive calls, and dynamic data structures like pointers and sets, all within a block-structured syntax that scopes variables locally to promote readability and . Pascal's design prioritizes a small set of orthogonal concepts with a unified syntax, making it suitable for both teaching and practical , though it initially lacked features like dynamic arrays, which were later addressed in extensions. Pascal's influence extended far beyond education, shaping the development of subsequent languages such as Modula-2, Oberon, and Ada through its advocacy for data abstraction and structured design. Implementations like the UCSD Pascal system in the late 1970s popularized it on microcomputers such as the Apple II, while Borland's Turbo Pascal in the 1980s made it a staple for IBM PC development, contributing to its widespread use until the rise of object-oriented languages like C++ in the 1990s. Wirth's contributions, including Pascal, earned him the Turing Award in 1984, recognizing its role in advancing programming language design and software engineering principles; Wirth died on January 1, 2024. Despite declining in mainstream use, Pascal variants like Free Pascal and Delphi continue to support modern applications, preserving its legacy in education and embedded systems.

History

Origins in earlier languages

Pascal's design drew heavily from the algorithmic language , which served as its primary influence by providing a foundation in block structure, lexical scoping, and support for recursive procedures. These elements allowed for modular, hierarchical program organization, where code blocks could define local variables visible only within their scope, promoting cleaner and more maintainable code compared to earlier languages with global visibility. 's formal syntax and emphasis on structured expression further shaped Pascal's syntax, with simplifications such as removing name parameters and streamlining the for-loop to enhance readability and implementation efficiency. Additional influences came from , particularly in handling numerical computations through array structures for vectors and matrices, which Pascal adopted to support scientific applications while addressing FORTRAN's limitations, such as the absence of records that complicated data translations. From , Pascal incorporated record and file types to improve data organization for commercial tasks, alongside an emphasis on readability aimed at non-expert users, broadening its applicability beyond . Niklaus Wirth's motivations in the late stemmed from frustrations with the era's language projects, notably the failures of , which attempted to merge 's scientific focus with COBOL's business orientation but resulted in excessive complexity and poor reliability. He sought a simpler alternative for teaching programming as a disciplined activity, prioritizing strong typing to enforce at and paradigms—inspired by Edsger Dijkstra's 1968 critique—to eliminate reliance on unstructured jumps like GOTO statements prevalent in languages such as BASIC and early . This focus on reliability and ease of instruction positioned Pascal as a reaction to the "" highlighted at the 1968 NATO conference, aiming for a language that balanced expressiveness with verifiability.

Development by Niklaus Wirth

, who joined the Swiss Federal Institute of Technology in Zurich () as a professor in 1968, initiated the design of Pascal as a response to the limitations of existing programming languages for teaching purposes. At ETH, where was used but suffered from inadequate compilers on the institution's mainframes (such as the CDC 160 series), Wirth proposed Pascal in 1968 as a structured teaching language to address the emerging and promote disciplined programming practices. Influenced by earlier languages like , the proposal emphasized simplicity and educational value to foster problem-oriented thinking among students. The core design principles of Pascal centered on portability, readability, and the enforcement of good programming habits through compiler-enforced restrictions. Portability was prioritized to allow implementation across diverse hardware, initially achieved via a single-pass and later enhanced with intermediate P-code. Readability was improved by simplifying syntax, such as replacing Algol's complex for-statements with more intuitive while loops, and defining the language formally using Extended Backus-Naur Form (EBNF). To encourage , Pascal incorporated strong static typing, block structuring, and restrictions on unstructured control flows like statements, preventing common errors and promoting modular code. Development proceeded from 1968 to 1970, with Wirth leading a small team at . The project began with the language specification in 1968, followed by initial compiler attempts in 1969 using , which proved unsuccessful, prompting a redesign. By early 1970, the first working compiler—a top-down, recursive-descent parser—was completed for the , compiling a subset called Pascal-S optimized for the machine's constraints. The full language report was published in 1970, marking the completion of the initial design phase. Wirth collaborated closely with students and assistants, including Urs Ammann and Jürg Gutknecht, who contributed to the early implementation efforts alongside initial team member Erich Marmier. Ammann later developed a more advanced version by , while Gutknecht supported the foundational work on the CDC system. This teamwork enabled the and refinement of Pascal's features, ensuring it met educational goals without excessive complexity.

Initial release and early adoption

Pascal was officially released in 1970 through a titled "The Programming Language Pascal," published by the Department of at . This report, authored by , provided the definitive specification of the language, building on his earlier design goals to create a structured alternative to existing languages like ALGOL 60. The release marked the formal availability of Pascal for implementation and use, initially targeting academic and research communities. Early ports of Pascal quickly followed the release, extending its reach to prominent mainframe systems. Implementations were developed for machines such as the PDP-11 at the and the , including a notable port at supported by a U.S. grant. These efforts demonstrated Pascal's portability and feasibility on diverse hardware, facilitating its experimentation in research settings during the early 1970s. Adoption in educational environments accelerated soon after, with Pascal integrated into introductory programming courses at starting in late 1971. By 1972, it had also been adopted for teaching at , where the first successful runs of Pascal programs on the occurred in December of that year. This early academic uptake highlighted Pascal's suitability for teaching principles. The language's dissemination was bolstered by key publications, including Wirth's revised report "The Programming Language Pascal" in 1973, which incorporated feedback from initial implementations and clarified the language definition. This document, along with related articles in journals like Acta Informatica, provided essential resources for educators and researchers, contributing to Pascal's growing influence in curricula.

Implementations

Early compilers and interpreters

The first implementation of Pascal was the Pascal-P compiler, developed by and his team at for the mainframe computers, becoming operational in early 1970. This employed a one-pass utilizing top-down recursive-descent , which prioritized efficiency and simplicity to match the performance of contemporary FORTRAN compilers on the same hardware. The approach allowed for rapid compilation while enforcing strict type checking, though it initially omitted features like and dynamic arrays to simplify implementation on the limited resources of 1970s mainframes. A significant advancement came with the p-System, initiated in 1974 at the under Kenneth Bowles and released in 1978, which introduced a portable architecture to address the growing diversity of minicomputers and early microcomputers. The p-System compiled Pascal source code into intermediate p-code, executed by a host-specific interpreter emulating a stack-oriented , enabling binary portability across platforms without recompilation. This interpreter-based model traded some runtime speed for broad compatibility, supporting nearly 20 different processors by the early . Early Pascal implementations faced substantial challenges due to memory constraints on minicomputers and microcomputers, often limited to 64 KB or less, which necessitated subsetted versions of the to fit within these bounds. For instance, the p-System's 16-bit addressing restricted full support, leading to omissions in features like large data structures, while cross-compilation techniques were developed to generate code for resource-poor targets from more powerful host machines. Among the key innovations in these early tools were support for separate compilation via modules and cross-compilation strategies tailored for microcomputers. The UCSD p-System pioneered construct, allowing programs to be divided into separately compilable modules with distinct interface and sections, facilitating modular development on constrained systems. Cross-compilers, such as those producing p-code for LSI-11 minicomputers, enabled development on mainframes for deployment on microcomputers, overcoming the lack of native compilation resources on early personal systems. These features laid groundwork for Pascal's expansion beyond academic environments.

Turbo Pascal and Borland ecosystem

In 1983, Borland International released 1.0, targeting the PC and systems, at an affordable price of $49.99 to make high-quality Pascal development accessible to hobbyists and small developers. This version introduced an (IDE) that combined an editor, , and in a single, menu-driven interface, enabling rapid compilation times—often under a second for small programs—on 8088 processors with as little as 64 KB of RAM. It also supported inline for performance-critical code, allowing developers to embed x86 instructions directly within Pascal routines to optimize executables for the limited resources of early personal computers. Over the subsequent years, Turbo Pascal evolved significantly, with version 4.0 in 1987 introducing units—modular source files that separated interface declarations from implementation details, promoting code reusability and larger project organization beyond the single-file limitations of earlier versions. By 5.5, released in May 1989 and priced at $149.95, the compiler added support for execution on 80286 or higher processors, enabling programs to access up to 16 MB of memory while maintaining compatibility with real-mode DOS environments. Borland's broader ecosystem extended Turbo Pascal's utility through complementary tools, including the framework introduced in version 6.0 (1990), an object-oriented library for building text-based user interfaces with windows, menus, and to create professional-looking DOS applications efficiently. This was complemented by database integration capabilities, such as the Turbo Database Toolbox (released 1985) for handling indexed files and structures, and seamless connectivity with Borland's relational database system, allowing Pascal programs to query and manipulate data via embedded SQL-like interfaces.

Free Pascal and contemporary variants

The Free Pascal Compiler (FPC), an open-source implementation of Pascal and , was initiated in 1993 by Florian Klämpfl as a response to the limitations of proprietary compilers, with its first public release occurring in 1996. Designed for cross-platform development, FPC supports a wide array of processor architectures, including x86 (both 16-bit and 32-bit), , , PowerPC, and others, enabling compilation for operating systems such as Windows, , macOS, and embedded environments. This multi-target capability has made it a popular choice for developers seeking portability without reliance on vendor-specific tools. Another notable open-source variant, Pascal (GPC), emerged as a Pascal frontend integrated into the Compiler Collection (GCC), providing compatibility with ISO Pascal standards and extensions for systems. Development of GPC continued through the 1990s and early 2000s, but it was effectively discontinued after its final release in 2005, with maintenance ceasing due to shifting priorities in the project and the rise of more active alternatives like FPC. In contemporary applications, remains relevant in embedded systems for its lightweight footprint and support for resource-constrained devices like microcontrollers on architectures. It is also employed in game development through bindings to libraries such as SDL, facilitating cross-platform titles with efficient graphics and input handling, as demonstrated in tutorials for SDL2 and SDL3 integration. Additionally, FPC serves educational purposes, often paired with the Lazarus IDE to teach programming concepts in a structured, type-safe environment across multiple platforms. As of 2025, the latest stable release is FPC 3.2.2, issued in May 2021, which includes enhancements to code generation and optimization, alongside ongoing experimental improvements to its backend for better with modern toolchains and potential gains on supported platforms. Development continues actively, with efforts focusing on further support and integration with emerging standards.

Language features

Data types and type system

Pascal's type system is static and strongly typed, requiring all variables to be declared with a specific type before use, which promotes error detection at . This design, introduced in the original Pascal report by and C. A. R. Hoare, emphasizes by prohibiting implicit type conversions except in limited cases, such as assigning an integer to a real. The ISO 7185 standard formalized these principles, defining types as either simple (ordinal or real) or structured, with no support for dynamic typing or automatic coercions that could lead to runtime errors. Primitive types in Pascal include ordinal types like , char, , and user-defined enumerated types, alongside the real type for floating-point numbers. Enumerated types allow programmers to define a list of named constants with ordinal positions starting from 0, such as type color = ([red](/page/Red), [green](/page/Green), [blue](/page/Blue));, enhancing and . The type represents whole numbers within an implementation-defined range, typically -32768 to 32767 for 16-bit variants or -2147483648 to for 32-bit variants, with the constant MaxInt denoting the maximum positive value. The real type accommodates floating-point values, also implementation-defined, supporting arithmetic operations but lacking ordinal properties for indexing. Char denotes individual characters from an implementation-defined set, such as ASCII, with ordinal values starting from 0, while is an ordinal type with exactly two values: false (ordinal 0) and true (ordinal 1), using literals true and false in expressions. The following example illustrates simple variable declarations using primitive types:

pascal

program VariableExample; var i: integer; r: real; c: char; b: boolean; begin i := 42; r := 3.14; c := 'A'; b := true; end. ```[](http://pascal.hansotten.com/uploads/books/Pascal_User_Manual_and_Report_Fourth_Edition.pdf) Structured types build upon primitives to form composite data, including arrays, records, sets, and files. Arrays are fixed-size collections indexed by an ordinal type, declared as `array [low..high] of component_type`, where the index range is static and the component type can be any valid type; dynamic arrays were not part of the original standard but appeared in extensions. Records aggregate heterogeneous fields, accessed by name, and support variant parts for discriminated unions, allowing conditional field inclusion based on a tag field, as in `record case tag: boolean of true: (field1: integer); false: (field2: real) end`. Sets represent unordered collections of unique values from a subrange of an ordinal type, declared as `set of base_type`, enabling operations like union (+), intersection (*), and membership (in); for example, `set of ['a'..'z']` forms the power set of lowercase letters. Files are structured types for sequential data storage, declared as `file of component_type`, with details covered in input/output handling. Subrange types restrict an ordinal type to a bounded interval, such as `1..100` for positive integers up to 100, inheriting the host type's operations while enforcing bounds checks.[](https://www.cs.utexas.edu/~novak/iso7185.pdf)[](http://pascal.hansotten.com/uploads/books/Pascal_User_Manual_and_Report_Fourth_Edition.pdf)[](https://www.moorecad.com/standardpascal/iso7185rules.html) Pointer types form a distinct category, declared as `^domain_type`, where values are either the predefined nil or a dynamic [reference](/page/Reference) to a variable of the domain type. Pointers enable dynamic memory allocation using the new procedure to create heap variables and dispose to release them, supporting features like linked lists and trees for flexible data structures.[](https://www.cs.utexas.edu/~novak/iso7185.pdf) Type compatibility in Pascal is strictly enforced to prevent type mismatches, requiring identical or assignment-compatible types for operations like assignment or [parameter](/page/Parameter) passing. Two types are identical if they share the same declaration; otherwise, they are compatible if both are subranges of the same host type, or if they are sets with compatible base types (considering packed status), or strings with matching component counts. Assignment compatibility extends this to allow integers to reals (with implicit widening) and values within subrange or set bounds, but rejects file types or out-of-bounds values, ensuring no silent [data corruption](/page/Data_corruption). This rigorous system, without implicit conversions for most types, distinguishes Pascal from languages with weaker typing, reducing bugs in safety-critical applications.[](https://www.cs.utexas.edu/~novak/iso7185.pdf)[](https://www.moorecad.com/standardpascal/iso7185rules.html)[](http://pascal.hansotten.com/uploads/books/Pascal_User_Manual_and_Report_Fourth_Edition.pdf) ### Control structures and flow Pascal's control structures were designed to promote [structured programming](/page/Structured_programming) principles, facilitating clear and verifiable program flow by relying on hierarchical compositions of statements rather than unstructured transfers of control. Influenced by Edsger Dijkstra's advocacy against unrestricted jumps, [Niklaus Wirth](/page/Niklaus_Wirth) intended Pascal to serve as a [teaching](/page/Teaching) tool for disciplined programming, where control proceeds sequentially or through well-defined conditional and repetitive constructs.[](http://pascal.hansotten.com/niklaus-wirth/recollections-about-the-development-of-pascal/) Although the original design omitted the [GOTO](/page/Goto) statement to enforce this discipline, practical demands from early implementers led to its inclusion with strict limitations, such as requiring labels to be declared within the same block and prohibiting transfers into structured statements like loops or conditionals.[](http://pascal.hansotten.com/niklaus-wirth/recollections-about-the-development-of-pascal/) These restrictions ensure that [GOTO](/page/Goto) cannot disrupt the intended structure, making it suitable only for exceptional cases like error exits, while encouraging developers to favor the provided control mechanisms.[](http://pascal.hansotten.com/uploads/books/Pascal_User_Manual_and_Report_Fourth_Edition.pdf) The primary conditional construct is the **if-then-else** statement, which enables selective execution based on a Boolean expression. Its syntax is: ```pascal if &lt;boolean_expression&gt; then &lt;statement&gt; [else &lt;statement&gt;]

program VariableExample; var i: integer; r: real; c: char; b: boolean; begin i := 42; r := 3.14; c := 'A'; b := true; end. ```[](http://pascal.hansotten.com/uploads/books/Pascal_User_Manual_and_Report_Fourth_Edition.pdf) Structured types build upon primitives to form composite data, including arrays, records, sets, and files. Arrays are fixed-size collections indexed by an ordinal type, declared as `array [low..high] of component_type`, where the index range is static and the component type can be any valid type; dynamic arrays were not part of the original standard but appeared in extensions. Records aggregate heterogeneous fields, accessed by name, and support variant parts for discriminated unions, allowing conditional field inclusion based on a tag field, as in `record case tag: boolean of true: (field1: integer); false: (field2: real) end`. Sets represent unordered collections of unique values from a subrange of an ordinal type, declared as `set of base_type`, enabling operations like union (+), intersection (*), and membership (in); for example, `set of ['a'..'z']` forms the power set of lowercase letters. Files are structured types for sequential data storage, declared as `file of component_type`, with details covered in input/output handling. Subrange types restrict an ordinal type to a bounded interval, such as `1..100` for positive integers up to 100, inheriting the host type's operations while enforcing bounds checks.[](https://www.cs.utexas.edu/~novak/iso7185.pdf)[](http://pascal.hansotten.com/uploads/books/Pascal_User_Manual_and_Report_Fourth_Edition.pdf)[](https://www.moorecad.com/standardpascal/iso7185rules.html) Pointer types form a distinct category, declared as `^domain_type`, where values are either the predefined nil or a dynamic [reference](/page/Reference) to a variable of the domain type. Pointers enable dynamic memory allocation using the new procedure to create heap variables and dispose to release them, supporting features like linked lists and trees for flexible data structures.[](https://www.cs.utexas.edu/~novak/iso7185.pdf) Type compatibility in Pascal is strictly enforced to prevent type mismatches, requiring identical or assignment-compatible types for operations like assignment or [parameter](/page/Parameter) passing. Two types are identical if they share the same declaration; otherwise, they are compatible if both are subranges of the same host type, or if they are sets with compatible base types (considering packed status), or strings with matching component counts. Assignment compatibility extends this to allow integers to reals (with implicit widening) and values within subrange or set bounds, but rejects file types or out-of-bounds values, ensuring no silent [data corruption](/page/Data_corruption). This rigorous system, without implicit conversions for most types, distinguishes Pascal from languages with weaker typing, reducing bugs in safety-critical applications.[](https://www.cs.utexas.edu/~novak/iso7185.pdf)[](https://www.moorecad.com/standardpascal/iso7185rules.html)[](http://pascal.hansotten.com/uploads/books/Pascal_User_Manual_and_Report_Fourth_Edition.pdf) ### Control structures and flow Pascal's control structures were designed to promote [structured programming](/page/Structured_programming) principles, facilitating clear and verifiable program flow by relying on hierarchical compositions of statements rather than unstructured transfers of control. Influenced by Edsger Dijkstra's advocacy against unrestricted jumps, [Niklaus Wirth](/page/Niklaus_Wirth) intended Pascal to serve as a [teaching](/page/Teaching) tool for disciplined programming, where control proceeds sequentially or through well-defined conditional and repetitive constructs.[](http://pascal.hansotten.com/niklaus-wirth/recollections-about-the-development-of-pascal/) Although the original design omitted the [GOTO](/page/Goto) statement to enforce this discipline, practical demands from early implementers led to its inclusion with strict limitations, such as requiring labels to be declared within the same block and prohibiting transfers into structured statements like loops or conditionals.[](http://pascal.hansotten.com/niklaus-wirth/recollections-about-the-development-of-pascal/) These restrictions ensure that [GOTO](/page/Goto) cannot disrupt the intended structure, making it suitable only for exceptional cases like error exits, while encouraging developers to favor the provided control mechanisms.[](http://pascal.hansotten.com/uploads/books/Pascal_User_Manual_and_Report_Fourth_Edition.pdf) The primary conditional construct is the **if-then-else** statement, which enables selective execution based on a Boolean expression. Its syntax is: ```pascal if &lt;boolean_expression&gt; then &lt;statement&gt; [else &lt;statement&gt;]

If the boolean_expression evaluates to true, the statement following then is executed; otherwise, if an else clause is present, its statement is executed. The boolean_expression typically involves comparisons of ordinal or compatible types, such as integers or characters, but must resolve to a Boolean value. To handle multiple mutually exclusive conditions—often referred to as elsif chains in dialect extensions—standard Pascal requires nesting if statements within else clauses, using begin-end blocks for compound statements to maintain readability. For example:

pascal

if x &gt; 0 then y := x else if x &lt; 0 then y := -x else y := 0;

if x &gt; 0 then y := x else if x &lt; 0 then y := -x else y := 0;

This nested form ensures logical progression without ambiguity, aligning with Pascal's emphasis on explicit control. Pascal provides three iterative constructs for repetition, each suited to different scenarios: definite iteration with for loops, pretest loops with while-do, and posttest loops with repeat-until. The for loop is used for definite iteration over a known range of ordinal values, with syntax:

pascal

for &lt;control_variable&gt; := &lt;initial_value&gt; (to | downto) &lt;final_value&gt; do &lt;statement&gt;

for &lt;control_variable&gt; := &lt;initial_value&gt; (to | downto) &lt;final_value&gt; do &lt;statement&gt;

The control_variable, an ordinal type like , is assigned the initial_value and incremented (to) or decremented (downto) by 1 until reaching or passing the final_value, executing the statement each . The variable's value is undefined after the loop, and it must not be modified inside the loop body to preserve . An example computes the :

pascal

sum := 0; for i := 1 to 10 do sum := sum + i * i;

sum := 0; for i := 1 to 10 do sum := sum + i * i;

The while-do loop performs pretest :

pascal

while &lt;boolean_expression&gt; do &lt;statement&gt;

while &lt;boolean_expression&gt; do &lt;statement&gt;

It evaluates the boolean_expression before each , executing the statement zero or more times if true, and terminates immediately if false. This is ideal for indefinite loops where continuation depends on a changing condition, such as searching an . In contrast, the repeat-until loop guarantees at least one execution with posttest :

pascal

repeat &lt;statement&gt; until &lt;boolean_expression&gt;

repeat &lt;statement&gt; until &lt;boolean_expression&gt;

The statement (or compound block) runs repeatedly until the boolean_expression becomes true, after which the loop exits. This construct is useful for tasks requiring initialization before checking, like reading input until valid. For instance:

pascal

repeat write('Enter positive number: '); readln(x) until x &gt; 0;

repeat write('Enter positive number: '); readln(x) until x &gt; 0;

These loops collectively support both counted and condition-based repetition without needing auxiliary counters or jumps. For multi-way branching on discrete values, Pascal includes the case statement, which selects among alternatives based on an ordinal selector expression. Its syntax is:

pascal

case &lt;selector_expression&gt; of &lt;constant_list1&gt; : &lt;statement1&gt;; &lt;constant_list2&gt; : &lt;statement2&gt;; ... end

case &lt;selector_expression&gt; of &lt;constant_list1&gt; : &lt;statement1&gt;; &lt;constant_list2&gt; : &lt;statement2&gt;; ... end

The selector_expression must be of an ordinal type (e.g., , char, enum), and each constant_list comprises distinct constants of that type separated by commas. Execution jumps to the statement matching the selector's value; if no match, the program's behavior is undefined, often resulting in a runtime error in implementations. Standard Pascal lacks an explicit "otherwise" clause, requiring programmers to include a default case covering all possibilities for robustness, such as a final case for all remaining values using a range like 0..9999: default_action. An example for menu selection:

pascal

case choice of 'A': process_A; 'B': process_B; otherwise writeln('Invalid choice'); end

case choice of 'A': process_A; 'B': process_B; otherwise writeln('Invalid choice'); end

Note that while "otherwise" is not part of the core , comprehensive case designs anticipate non-matches to uphold structured integrity. This statement efficiently replaces nested ifs for exhaustive checks on small sets, enhancing clarity.

Procedures, functions, and modules

Pascal's support for is embodied in its procedures and functions, which serve as subroutines for organizing into reusable blocks, and in its program structure, which facilitates encapsulation through declaration and implementation sections. In the original design, procedures and functions are nested within the main program block or other subprograms, promoting structured without requiring separate files. Later dialects introduced units to enable separate compilation, enhancing for larger projects. Procedures are void subroutines that perform actions without returning a value and are invoked via procedure statements. They support pass-by-value , where the actual argument is copied to a local formal , preventing modification of the original data, and pass-by-reference parameters using the var keyword, which allow direct modification of the actual argument. For example, a procedure to swap two integers might use var parameters:

pascal

procedure Swap(var A, B: Integer); var Temp: Integer; begin Temp := A; A := B; B := Temp; end;

procedure Swap(var A, B: Integer); var Temp: Integer; begin Temp := A; A := B; B := Temp; end;

This design ensures and controlled side effects, as outlined in the language report. Functions extend procedures by returning a single value of a specified type, which must be assigned via the function identifier within the body to ensure type-checked returns. They are used in expressions and support the same parameter mechanisms as procedures, but the return type is restricted to ordinal, real, or pointer types in standard Pascal. A recursive function for computing the illustrates this:

pascal

function GCD(M, N: Integer): Integer; begin if N = 0 then GCD := M else GCD := GCD(N, M mod N); end;

function GCD(M, N: Integer): Integer; begin if N = 0 then GCD := M else GCD := GCD(N, M mod N); end;

The function's result is verified at against its declared type, reinforcing Pascal's strong typing discipline. Pascal's program structure organizes code into blocks comprising declaration parts— for labels, constants, types, variables, and subprograms—followed by a statement part, enabling nested where inner blocks inherit outer scopes. Forward declarations allow a procedure or function heading to precede its full definition, marked by the forward directive, which supports by permitting calls between subprograms before their complete implementations. For instance:

pascal

procedure P; forward; procedure Q; begin P; { Call to forward-declared P } end; procedure P; begin Q; { Mutual recursion } end;

procedure P; forward; procedure Q; begin P; { Call to forward-declared P } end; procedure P; begin Q; { Mutual recursion } end;

This mechanism resolves dependencies during compilation without requiring a specific order. In dialects such as Turbo Pascal, modularity is advanced through units, which separate public interfaces from private implementations to support independent compilation. A unit begins with an interface section declaring visible constants, types, variables, and subprogram headings, followed by an implementation section providing the bodies and any private elements, optionally ending with an initialization block executed on loading. Units are compiled to object files (e.g., .TPU) and incorporated via a uses clause, with the compiler verifying interface consistency across compilations. An example unit structure is:

pascal

unit MathUtils; interface function Square(X: Real): Real; implementation function Square(X: Real): Real; begin Square := X * X; end; end.

unit MathUtils; interface function Square(X: Real): Real; implementation function Square(X: Real): Real; begin Square := X * X; end; end.

This approach allows large programs to be divided into reusable, separately compilable modules, addressing limitations in the original single-file structure.

I/O and file handling

Pascal provides built-in support for input and output operations through typed file structures, emphasizing and to promote reliable data handling. Files are declared as structured types, specifically file of component-type, where the component type determines the data elements stored sequentially in the file. This design ensures that only compatible values can be read or written, aligning with Pascal's strong . Text files represent a specialized category of files, predefined as type text, consisting of lines of characters terminated by end-of-line markers. These are particularly suited for human-readable data. In contrast, general files, such as file of [integer](/page/Integer) or file of char, support unformatted, binary storage of homogeneous components, enabling efficient handling of structured or . For instance, a file of —leveraging Pascal's record type—allows sequential storage and retrieval of composite data structures like employee details, where each record is a fixed component. Standard input and output are facilitated by two predefined text files: input for reading from the default (typically the keyboard) and output for writing to the default (typically the screen or console). At program startup, reset(input) and rewrite(output) are implicitly executed, placing input in inspection mode for reading and output in generation mode for writing. These predeclared files serve as program parameters, allowing direct use of I/O procedures without explicit declaration. To access files, programmers must first associate a file variable with an external file using the assign procedure (implementation-dependent in the standard but commonly used), followed by reset(f) to open an existing file for reading or rewrite(f) to create or truncate a file for writing. For text files, the read(f, v) procedure transfers data from the file buffer f^ into variable v (supporting types like integer, real, char, boolean, or strings) and advances the file position via an internal get(f) call; similarly, write(f, e) assigns expression e to f^ and advances via put(f), with optional width and precision parameters for formatting (e.g., write(f, x:5:2) for a real number). For general files, direct buffer access with f^ combined with explicit get(f) and put(f) enables binary I/O, such as reading or writing raw bytes or records. The readln(f) and writeln(f) variants handle line-oriented operations by consuming or emitting end-of-line markers. The following example demonstrates a simple output operation using the predefined output file:

pascal

program SimpleOutput; begin writeln('Hello, World!'); end. ```[](http://pascal.hansotten.com/uploads/books/Pascal_User_Manual_and_Report_Fourth_Edition.pdf) End-of-file and end-of-line conditions are detected using the [boolean](/page/Boolean) functions `eof(f)` and `eoln(f)`. The `eof(f)` function returns true if the file is in [inspection](/page/Inspection) mode and the unread sequence is empty, signaling the end during sequential reads; it raises an [error](/page/Error) if the file is undefined or in [generation](/page/Generation) mode. Likewise, `eoln(f)` returns true for text files when the current line's unread characters are exhausted but before advancing to the next line. These functions are essential for robust loop control in file [processing](/page/Processing), as in: ```pascal var f: text; ch: char; begin assign(f, 'data.txt'); reset(f); while not eof(f) do begin while not eoln(f) do begin read(f, ch); write(ch); end; readln(f); writeln; end; close(f); end.

program SimpleOutput; begin writeln('Hello, World!'); end. ```[](http://pascal.hansotten.com/uploads/books/Pascal_User_Manual_and_Report_Fourth_Edition.pdf) End-of-file and end-of-line conditions are detected using the [boolean](/page/Boolean) functions `eof(f)` and `eoln(f)`. The `eof(f)` function returns true if the file is in [inspection](/page/Inspection) mode and the unread sequence is empty, signaling the end during sequential reads; it raises an [error](/page/Error) if the file is undefined or in [generation](/page/Generation) mode. Likewise, `eoln(f)` returns true for text files when the current line's unread characters are exhausted but before advancing to the next line. These functions are essential for robust loop control in file [processing](/page/Processing), as in: ```pascal var f: text; ch: char; begin assign(f, 'data.txt'); reset(f); while not eof(f) do begin while not eoln(f) do begin read(f, ch); write(ch); end; readln(f); writeln; end; close(f); end.

This example demonstrates sequential reading, though close is implementation-specific. General files operate similarly but without line semantics, relying on eof(f) for termination. Pascal's file model enforces , with no built-in support for random positioning in the standard, ensuring predictable behavior across implementations.

Standards and dialects

ISO 7185 standard

The ISO/IEC 7185:1990 standard, published in 1990 as the second edition of the international specification for the Pascal programming language, formalized Niklaus Wirth's original design to ensure portability across diverse systems. It replaced the initial 1983 edition (ISO 7185:1983) by correcting errors, resolving ambiguities, and aligning with the contemporaneous ANSI/IEEE standard (ANSI/IEEE 770 X3.97-1983), without introducing new language concepts. The standard defines an unambiguous, machine-independent syntax and semantics for Pascal, emphasizing principles to promote reliable . To facilitate varying degrees of implementation complexity and compliance, ISO 7185 specifies two levels: Level 0, which excludes advanced features like conformant array parameters for broader portability, and Level 1, which includes them alongside other optional elements. Core mandated features across both levels include block structure—comprising a program heading, declaration sections for labels, constants, types, variables, and procedures, followed by a statement sequence—and strong static typing, which enforces type compatibility in assignments, expressions, and parameter passing to prevent type errors at compile time. The standard also prohibits undefined behaviors by requiring processors to detect and report errors such as bounds violations, uninitialized variables, and incompatible types, though some implementation-defined aspects (e.g., exact error handling) are permitted if they do not affect program semantics. Compared to Wirth's original Pascal as described in User Manual and Report, ISO 7185 introduced refinements for standardization, such as strict name equivalence (where types are equivalent only if identically declared), mandatory of names before use, and restricting loop indices to ordinal types, while making conformant parameters optional in Level 0 to enhance portability across simpler compilers. These changes prioritized consistency and verifiability over some original extensions, ensuring the language's core remained intact but more rigorously defined. Following its publication, certification efforts for ISO 7185 compliance relied on dedicated testing suites, including the British Standards Institution (BSI) Pascal Validation Suite and the Pascal Acceptance Test (PAT), which comprised comprehensive test programs covering all features to verify processor adherence at Levels 0 and 1. These suites enabled formal validation services, with organizations like BSI providing to confirm implementations met the standard's requirements without deviations in , semantics, or detection. Early compilers, such as those from the and CDC, pursued compliance testing using these tools to align with the standardized Pascal.

Extended Pascal (ISO 10206)

Extended Pascal, formally known as ISO/IEC 10206:1991, represents an extension to the base Pascal standard (ISO 7185:1990), extending the base Pascal standard (ISO 7185:1990 and equivalent ANSI/IEEE 770 X3.97-1983) with enhancements from ANSI/IEEE 770X3.160-1990 for more complex software development. The equivalent ANSI/IEEE standard (770X3.160-1990) was published in October 1990, with ISO/IEC 10206:1991 approved and published in April 1991, maintaining full upward compatibility with the core language to ensure portability across data processing systems. This standard was developed by the Joint X3J9/IEEE P770 Pascal Standards Committee in collaboration with ISO working group WG2, aiming to standardize popular extensions that had arisen in commercial implementations. A primary addition is the module system, which enables separate compilation of program components while preserving type security. Modules consist of an interface section for exporting entities—such as constants, types, variables, procedures, and functions—and an optional implementation section, allowing partial imports, renaming, and protected variables to control access. For example, a module might declare module RandomUniform interface; function Uniform: real;, exporting only the necessary interface for reuse in larger programs. Schemata provide a mechanism for generics, defining parameterized types that map discriminant tuples (e.g., array bounds or record variants) to families of related types, selectable at compile-time or runtime via the new operator or extended with statements. Additionally, optional features include short-circuit Boolean operators and then and or else, which evaluate operands left-to-right and skip the right operand if the result is determined, improving efficiency in conditional expressions without altering logical equivalence to and and or. The rationale for Extended Pascal centered on supporting the development of larger, more maintainable systems amid Pascal's growing commercial adoption, while addressing incompatibilities from vendor-specific extensions and promoting international portability. By extending the base standard with these features, it facilitated and flexible type handling without compromising the language's emphasis on clarity and . Adoption of Extended Pascal remained limited compared to the base standard, as Pascal's popularity waned in favor of languages like and C++ during the ; however, it influenced specialized dialects and implementations, such as HP Pascal (later VSI Pascal), which incorporates many of its features for systems. Compilers like aimed for partial compliance, supporting modules and schemata but not full implementation, reflecting its niche role in legacy and embedded environments.

Object Pascal extensions

Object Pascal emerged as an object-oriented extension to the Pascal programming language, initially developed by Apple Computer in the early 1980s. The foundational work began with Clascal for the Lisa Workshop system around 1983, evolving into through efforts led by in collaboration with , Pascal's creator; this included the 1985 Object Pascal Report, which outlined key OOP principles adapted to Pascal's structured paradigm. Borland significantly advanced Object Pascal with the release of Turbo Pascal 5.5 in 1989, incorporating OOP features inspired by Apple's design, such as the introduction of the object type for defining classes with fields, methods, and . This extension allowed objects to inherit from parent objects, supporting single and enabling polymorphic behavior through virtual methods declared with the virtual keyword. For example, a base object could define a virtual procedure that subclasses override, promoting and extensibility in applications. In Turbo Pascal's syntax, objects were declared using the object ... end construct, where fields and methods followed without explicit visibility modifiers, relying on the order of declaration for . Subsequent evolutions, particularly in Borland's environment released in 1995, refined this into the class ... end syntax, introducing structured visibility sections like private, protected, and public to encapsulate data and methods more robustly. 's also added support for interfaces in later versions, such as Delphi 3 (1997), enabling multiple inheritance-like behavior through contract-based polymorphism without direct implementation inheritance.

Reception and legacy

Educational and academic influence

Pascal was designed by primarily as a teaching language to promote principles and address shortcomings in existing languages like and , which often encouraged unstructured coding practices. Wirth explicitly stated his dissatisfaction with major languages of the time, aiming for Pascal to serve as an effective tool for introducing students to systematic program design and data structuring. This intent positioned Pascal as an accessible alternative to low-level assembly languages and unstructured interpreters like , which dominated early but hindered the teaching of modular and readable code. By the 1980s, Pascal had become a cornerstone of curricula worldwide, adopted in universities across , , and beyond to teach fundamental programming concepts. Its emphasis on strong typing, block structures, and procedural abstraction facilitated the shift toward paradigms, significantly reducing reliance on assembly for systems-level understanding and BASIC for quick scripting, thereby enabling educators to focus on algorithmic thinking and software reliability. Institutions like , where Wirth developed the language, integrated Pascal into core courses, influencing generations of students and contributing to its status as one of the most widely used teaching languages of the era. The textbook Pascal User Manual and Report (1974), co-authored by Wirth and Kathleen Jensen, played a pivotal role in standardizing pedagogical approaches to the language. This comprehensive guide served as a primary reference for instructors, detailing syntax, semantics, and best practices in a manner that supported consistent teaching of across diverse educational settings. Its widespread adoption helped establish uniform curricula, making Pascal a reliable vehicle for conveying concepts like , , and handling in introductory programming. In the 2020s, Pascal and its variants, such as , continue to be employed in select introductory courses at universities and colleges, including those emphasizing foundational algorithms and data structures. For instance, Technical College offers CPT 132: Pascal Programming (3 credits) as part of its Computer Technology program to build core skills. This persistence underscores Pascal's enduring value in fostering disciplined coding habits amid evolving educational landscapes.

Commercial adoption and criticisms

During the 1980s, Pascal saw significant commercial adoption, particularly through Borland's , which revolutionized by offering a fast, affordable for DOS-based applications. Released in 1983 for $49.95, Turbo Pascal enabled rapid prototyping and compilation, making it a preferred choice for creating business tools, database applications, and utilities on early personal computers. Its popularity peaked as developers leveraged its structured syntax for efficient coding in resource-constrained environments, contributing to the growth of the PC software industry. Despite this success, Pascal faced substantial criticisms that hindered its broader commercial viability. The standard input/output facilities were notably defective, lacking portable mechanisms for handling files or command-line arguments beyond predefined inputs, which forced reliance on implementation-specific extensions and reduced cross-platform compatibility. Strings were not a built-in type but treated as fixed-size character arrays, where the array length formed part of the type definition, preventing reusable routines for variable-length strings without cumbersome workarounds. Additionally, the syntax was often described as verbose, with semicolons acting as separators rather than terminators—requiring precise placement to avoid errors—and excessive use of begin-end blocks for even simple constructs, increasing code bloat and maintenance effort. By the 1990s, Pascal's commercial momentum waned as it was overshadowed by C in systems programming and low-level applications. C's explicit support for pointers allowed finer control over memory management and hardware interaction, offering greater efficiency on Unix-based systems where Pascal's safer but more restrictive type system proved less flexible for performance-critical tasks. The Unix ecosystem's favoritism toward C further accelerated Pascal's decline, as major platforms like Apple's Macintosh shifted from Pascal variants to C and C++ for OS development. As of 2025, Pascal persists in niche commercial roles, particularly in embedded systems and legacy maintenance, supported by open-source implementations like . This compiler targets architectures such as , AVR, and for embedded applications, including real-time controllers and IoT devices, while maintaining compatibility with legacy environments like DOS and older x86 systems for sustaining vintage software bases.

Impact on subsequent languages

Pascal's emphasis on structured programming, strong typing, and modular design profoundly shaped Niklaus Wirth's subsequent languages, and , which extended its core principles for more advanced system development. , introduced in 1979, built directly on Pascal by incorporating modules to enable separate compilation, encapsulation, and type consistency checks across module boundaries, addressing limitations in large-scale software organization while preserving Pascal's and data abstraction features. , released in 1988, further refined these elements by simplifying 's syntax and integrating object-oriented capabilities, such as procedure variables for polymorphism, to promote even greater reliability and efficiency without added complexity. Beyond Wirth's lineage, Pascal's innovations influenced key features in C++, where its advocacy for strong static typing informed C++'s compile-time checks to enhance code organization and error detection, despite Stroustrup's view of Pascal's typing as overly restrictive. Pascal's record types also contributed to the conceptual foundation for C++ structs, which evolved from C's basic structures into more robust data aggregates supporting member functions and access controls. Pascal's promotion of extended to safety-critical domains, notably influencing Ada, where its strong typing and structured constructs were adapted to ensure verifiable reliability in embedded and real-time systems, with Ada's packages building on Pascal's modules for secure . This legacy is evident in , which incorporated robust static typing and object-oriented extensions inspired by Pascal and its descendants, enabling platform-independent code with built-in safeguards against type mismatches.

References

Add your contribution
Related Hubs
User Avatar
No comments yet.