Overview
There is no single Pascal. Niklaus Wirth designed the language in 1970 and described it
in the Pascal User Manual and Report; it was standardised as ISO 7185 and
extended by standard Extended Pascal, but the compilers people used (UCSD Pascal, Turbo
Pascal, Delphi, Free Pascal) each added their own features, and today “Pascal” in practice
means Object Pascal as Delphi and Free Pascal define it. A source file does not say which
dialect it is in, except through its first words (program with parameters,
uses, unit) and a {$mode} directive.
The standards
| Dialect | What it is and adds |
|---|---|
| Pascal (Wirth, 1970) | Typed, structured language with records, sets, files, pointers and variant records, designed for teaching. Procedures and functions nest; no modules. |
| ISO 7185 (also ANSI/IEEE 770X3.97, 1983; ISO 7185 revised 1990) | Standard Pascal. Level 0 is the language, level 1 adds conformant arrays (array parameters whose bounds come from the argument). Has program Name(Input, Output), label-const-type-var-routines in that order, get/put and buffer variables, pack/unpack, 35 reserved words, no strings other than packed array of char, no units, no else in case, no underscore in names, and (* and { comments that may close each other’s way. |
| Extended Pascal (ISO/IEC 10206:1990, revised 1991) | ISO 7185 plus modules (module, export, import), schema types (types with run-time parameters), string types of varying length, complex numbers, otherwise in case, ** and pow, and_then and or_else, initial values for variables, date and time functions, and direct-access files. Free Pascal reads it with {$mode extendedpascal} from version 3.2. The text of the standard was not read for this page. |
| UCSD Pascal (University of California San Diego, 1978) | The p-System Pascal, compiled to p-code and run on many small computers (Apple II, IBM PC). Added string (a length-prefixed type), unit with interface and implementation (the first Pascal units), segment procedure for overlays, intrinsic units, concat, copy, pos, delete, insert, and (*$ … *) compiler options. Turbo Pascal’s strings work in a similar way. |
| Apple Pascal, Mac Pascal (Apple Lisa and Macintosh: Lisa Pascal, MPW Pascal, Think Pascal, CodeWarrior Pascal) | The Pascal dialects of Apple’s machines, with object extensions. Free Pascal’s macpas mode aims at the common features of Think, Metrowerks and MPW Pascal. |
| GNU Pascal (GPC) | A Pascal front end for GCC that read ISO 7185, ISO 10206, Borland Pascal and parts of Delphi. No longer developed. |
Turbo Pascal and Borland Pascal
| Version | What it added |
|---|---|
| Turbo Pascal 1.0 (1983) | A fast integrated compiler, editor and runner for CP/M and DOS, with its own dialect of Pascal, including string, absolute and inline and the {$…} compiler options. |
| 2.0, 3.0 | Later versions of the original dialect, without units. |
| 4.0 | Units (unit, uses, interface, implementation), a project builder, and the byte, word, shortint and longint types. |
| 5.0, 5.5 | An integrated debugger (5.0); objects (object, constructor, destructor, virtual) and the new/dispose extensions (5.5). |
| 6.0 | An inline assembler (asm), and Turbo Vision (the text-mode user interface framework). |
| 7.0 and Borland Pascal 7.0 | Open array parameters, string parameters of any length ({$P}), the break and continue statements and {$X+} extended syntax; Borland Pascal also targets 286 protected mode (DPMI) and Windows, with Object Windows. |
| Turbo Pascal for Windows (1.0, 1.5) | The Windows version, with ObjectWindows and {$R}. |
Delphi (Object Pascal)
Delphi, from Borland (later Inprise, Borland again, CodeGear, and from 2008 Embarcadero), is Object Pascal: Turbo Pascal with classes, properties and exceptions, a form designer and a component library. Delphi 1 (1995) was 16-bit Windows; Delphi 2 and later 32-bit. The language grew with each release:
| Delphi | Language features |
|---|---|
| 1 | Classes (class, TObject), properties, published, try-except/finally, exceptions, is/as, method pointers (of object), virtual and dynamic methods, message methods. |
| 2 to 4 | 32-bit code; long strings (AnsiString, {$H+}), Variant and OleVariant, threadvar, resourcestring, interfaces and dispinterface, packages (package, requires, contains), safecall, overloading (overload), default parameters, dynamic arrays, Int64, implements for properties and reintroduce. |
| 6, 7 | The {$IF} conditional directive and {$IFEND}, and the deprecated and platform hint directives (6); warnings for unsafe code (7). |
| 2005, 2006 | Records with methods (record with methods and operators), for … in, nested types, class var, inline, strict private, sealed, abstract classes, static class methods, class constructor. |
| 2009 | Unicode (string is UnicodeString, Char is WideChar), generics, anonymous methods (reference to), Exit(value). |
| 2010 | Attributes and extended RTTI (TRttiContext). |
| XE2 – XE8 | 64-bit Windows, unit scope names (System.SysUtils), {$SCOPEDENUMS}, record helpers and type helpers (XE3), the ARC mobile compilers (XE4 – 10.3, later removed), dynamic array operations (XE7). |
| 10.x (Seattle, Berlin, Tokyo, Rio, Sydney) | Linux (10.2). Inline variable declarations (var X := 5), type inference, and for var I := … (10.3). Custom managed records with Initialize, Finalize, Assign operators; the unified memory model without ARC (10.4). |
| 11 (Alexandria) | The 11 series added more RTL and platform work; the language changes of this release were not checked here. |
| 12 (Athens, 2023) | Multi-line string literals (''' … '''). The language changes beyond this were not checked here. |
| 13 (Florence) | Not checked here. |
Free Pascal and Lazarus
Free Pascal (FPC) began in 1993 as a free 32-bit compiler of Turbo Pascal; it now reads several dialects and builds for dozens of processors and operating systems. Versions: 1.0 (2000), 2.0 (2005), 2.2, 2.4, 2.6, 3.0, 3.2 (2020) and 3.2.2 (2021); the development version is 3.3.1. Lazarus is the matching IDE and the LCL component library, mostly compatible with Delphi’s VCL.
The compiler modes
A {$MODE name} line, or a command line option, selects a set of language
features. The sets below are the mode switches that the compiler source turns on for each
mode (development version); a feature that is off in a mode is an error there.
| Mode | Mode switches on |
|---|---|
FPC (default) | nestedcomments, repeatforward, cvar, initfinal, hintdirective, properties, pchartostring, inline allowed |
OBJFPC | The FPC set plus class, objpas (the ObjPas unit), result, out, defaultparameters, exceptions, multilinestrings, typeinquiry |
DELPHI | class, objpas, result, pchartostring, pointertoprocvar, autoderef, classicprocvars, initfinal, ansistrings (string is AnsiString), out, defaultparameters, duplicatelocals, hintdirective, properties, exceptions, advancedrecords, arrayoperators, prefixedattributes, underscoreisseparator, functionreferences, anonymousfunctions, multilinestrings, statementexpressions, reorderedoperators; not nested comments. DELPHIUNICODE adds systemcodepage and unicodestrings |
TP | Turbo Pascal: classicprocvars, duplicate local names; the Object Pascal features are off |
MACPAS | cvar, macprocvars, nestedprocvars, nonlocalgoto, isounaryminus, inline allowed |
ISO | classicprocvars, duplicate names, nestedprocvars, nonlocalgoto, isounaryminus, isoio, isoprogramparas, isomod |
EXTENDEDPASCAL | The ISO set and typeinquiry |
Notable additions
- Octal numbers with
&(1.0.7),&before a reserved word to use it as a name (2.5.1), generics (2.x), Extended Pascal mode (3.2). - The development version adds multi-line strings, digit separators, anonymous functions, function references, statement expressions and the other switches listed on Compiler directives.
- Targets include Windows, Linux, macOS, FreeBSD, Android, iOS, Amiga, MS-DOS, OS/2 and bare-metal embedded boards.
Oxygene and other descendants
- Oxygene (RemObjects Software; earlier Chrome, and Prism at Embarcadero) is Object Pascal for .NET, Java and Cocoa, now part of the Elements compiler suite. It keeps the Pascal look and changes the language:
methoddeclares methods,namespacereplacesunit, strings may be written in double quotes, and it has keywords of its own that this site does not describe. - Smart Mobile Studio, PascalABC.NET, TMT Pascal and Virtual Pascal are other compilers that read the Delphi or Turbo Pascal dialect in part.
Telling the dialects apart in a file
| You see | It is |
|---|---|
program X(Input, Output); and no uses | ISO 7185 or an old textbook program |
uses Crt, Dos;, {$N+}, Mem[...], Port[...], far | Turbo Pascal or Borland Pascal for DOS |
unit with uses Windows, Messages, SysUtils, Classes, {$R *.DFM}, TForm | Delphi (VCL) |
{$mode objfpc}{$H+}, uses Classes, LCLType, Forms, {$I x.lrs} | Free Pascal, Lazarus |
uses System.SysUtils, FMX.Forms, inline var, ''' strings | Delphi 10.3 or later (12 for multi-line strings) |
namespace X;, method | Oxygene |
(* … *) only, (.….) instead of brackets | Very old or ISO-minded code |