Est. 1997 Beginner

Free Pascal

An open-source, cross-platform Pascal compiler compatible with Turbo Pascal and Delphi, supporting a wide range of operating systems and CPU architectures.

Created by Florian Klämpfl and the Free Pascal team

Paradigm Procedural, Object-Oriented, Generic, Imperative, Structured
Typing Static, Strong
First Appeared 1997
Latest Version Free Pascal 3.2.2 (May 2021)

Free Pascal is an open-source, cross-platform Pascal compiler designed as a free, modern successor to Borland’s Turbo Pascal. It combines high compatibility with both Turbo Pascal and Delphi dialects with support for an unusually broad range of operating systems and CPU architectures, making it one of the most portable Pascal implementations ever created.

History & Origins

Free Pascal began in 1993, when German computer science student Florian Klämpfl started writing a Turbo Pascal-compatible compiler so he could continue using Pascal after Borland’s Turbo Pascal for DOS was no longer being actively developed. The project was originally distributed under the name FPK Pascal (Klämpfl’s initials), and the first publicly released versions ran on DOS targeting 32-bit code via the GO32v1 DOS extender.

In 1997, the project was renamed to Free Pascal, reflecting both its open-source nature and its goal of providing a freely available Pascal toolchain. Around the same time, the project transitioned from a one-person effort into a collaborative one, with contributors porting the compiler to additional operating systems including Linux, OS/2, and Win32.

Free Pascal 1.0 was released in 2000, marking the first version considered stable for production use. Subsequent releases progressively added Delphi compatibility, additional CPU architectures, and language features inspired by modern Object Pascal.

Design Philosophy

Free Pascal’s design centers on a few clear goals:

  1. Compatibility — Provide drop-in compatibility with Turbo Pascal and Delphi so existing codebases can be compiled with minimal changes.
  2. Portability — Support as many operating systems and CPU architectures as practical, from current desktops to legacy and embedded platforms.
  3. Self-hosting — The compiler is itself written in Object Pascal and bootstraps on each supported platform.
  4. Predictability — Favor a stable, well-defined Pascal dialect with explicit modes rather than implicit behavior changes.

A distinguishing feature of Free Pascal is its mode system. The compiler can be told to interpret source code according to a specific dialect — {$mode objfpc}, {$mode delphi}, {$mode tp} (Turbo Pascal), {$mode iso}, or {$mode extendedpascal} — allowing the same compiler to handle Standard Pascal, ISO Pascal, Turbo Pascal, Delphi-style Object Pascal, and the project’s own ObjFPC dialect.

Key Features

Multiple Pascal Dialects

Free Pascal supports several Pascal dialects selectable per file or per project:

ModeDescription
objfpcFree Pascal’s preferred Object Pascal dialect
delphiDelphi-compatible Object Pascal
tpTurbo Pascal 7 compatibility
isoISO 7185 Standard Pascal
extendedpascalISO 10206 Extended Pascal
macproMacPas/Think Pascal-style dialect

Broad Platform Support

According to the official Free Pascal documentation, the compiler targets a wide variety of operating systems including Windows, Linux, macOS, FreeBSD, OpenBSD, NetBSD, Haiku, DOS (via DJGPP/GO32v2), OS/2, AmigaOS, MorphOS, AROS, Solaris, and others. Supported CPU architectures include i386, x86_64, ARM (32-bit), AArch64, PowerPC (32 and 64-bit), SPARC, MIPS, and a JVM bytecode backend.

The exact set of supported targets varies by version; the Free Pascal wiki maintains the authoritative list.

Object Pascal Features

Free Pascal supports modern Object Pascal features including:

  • Classes with single inheritance and interfaces
  • Properties with getters and setters
  • Generics (in both ObjFPC and Delphi modes)
  • Operator overloading
  • Anonymous methods (Delphi mode)
  • Exception handling with try..except..finally
  • RTTI (Runtime Type Information)
  • Inline assembler for supported architectures

Compatible with Lazarus

Free Pascal is the compiler underlying the Lazarus IDE, a Delphi-like cross-platform RAD environment. Together they form a complete free alternative to Delphi for building native desktop applications. Lazarus provides the Lazarus Component Library (LCL), which wraps native widgets on Windows, GTK, Qt, Cocoa (macOS), and others.

A Simple Free Pascal Program

program Greeting;

{$mode objfpc}{$H+}

uses
    SysUtils;

type
    TPerson = class
    private
        FName: string;
    public
        constructor Create(const AName: string);
        procedure Greet;
        property Name: string read FName;
    end;

constructor TPerson.Create(const AName: string);
begin
    FName := AName;
end;

procedure TPerson.Greet;
begin
    WriteLn('Hello, ', FName, '!');
end;

var
    P: TPerson;
begin
    P := TPerson.Create('World');
    try
        P.Greet;
    finally
        P.Free;
    end;
end.

Compile and run with:

1
2
fpc greeting.pas
./greeting

Evolution

Free Pascal has evolved steadily over more than two decades. Major milestones include:

  • 1.0 (2000): First stable release; multiple platform targets.
  • 2.0 (2005): x86_64 support; expanded Delphi compatibility.
  • 2.2 (2007–2008): ARM, PowerPC, and SPARC backends.
  • 2.6 (2012): Generics, improved RTL, better unit integration.
  • 3.0 (2015): Substantial improvements to Delphi compatibility, RTL, and platform coverage.
  • 3.2 (2020) and 3.2.2 (2021): Refinements, bug fixes, and additional targets.

Development continues on the 3.3.x trunk toward future releases, with community contributors steadily working on language and toolchain improvements.

Current Relevance

Free Pascal occupies a distinctive niche in the modern programming landscape. It is:

  • The compiler of choice for keeping legacy Turbo Pascal and Delphi codebases running on current systems.
  • The engine behind Lazarus, an actively developed cross-platform RAD environment.
  • A practical choice for native desktop applications where small binary size, predictable performance, and a strong type system are valued.
  • A teaching tool — Pascal remains popular in some educational settings, and Free Pascal provides a free, modern way to use it.

While Pascal-family languages no longer dominate mainstream development as they did in the Turbo Pascal era, Free Pascal’s combination of legacy compatibility, portability, and an active open-source community has kept the ecosystem alive and useful.

Why Free Pascal Matters

Free Pascal demonstrates how a focused, community-driven compiler project can keep an entire family of languages viable long after their commercial heyday. By providing a free, portable implementation that respects both the historical Turbo Pascal style and the modern Object Pascal of Delphi, Free Pascal preserves decades of Pascal code and continues to enable new development in a language that prizes clarity, structure, and strong typing.

For developers maintaining legacy systems, hobbyists building cross-platform desktop tools with Lazarus, or students learning structured programming, Free Pascal remains a thoughtful and capable choice.

Timeline

1993
Florian Klämpfl begins development of a Turbo Pascal-compatible compiler, initially called FPK Pascal
1997
First public release under the name Free Pascal Compiler (FPC)
2000
Version 1.0 released with support for multiple targets including Linux, DOS, Win32, OS/2, and AmigaOS
2003
Version 1.9 series introduces Delphi-compatible Object Pascal mode and significantly expanded standard library
2005
Version 2.0 released, adding x86_64 support and improved Delphi compatibility
2008
Version 2.2.2 brings stable support for ARM, PowerPC, and SPARC targets
2012
Version 2.6.0 released with support for generics, an enhanced RTL, and improved IDE integration
2017
Version 3.0.4 stabilizes 64-bit support across all major desktop platforms
2021
Version 3.2.2 released with bug fixes, additional platform support, and refinements to the Object Pascal dialect

Notable Uses & Legacy

Lazarus IDE

Lazarus is a cross-platform, Delphi-compatible RAD environment built entirely with Free Pascal, providing a visual form designer and the Lazarus Component Library (LCL) for native GUI development on Windows, macOS, Linux, and BSD.

Castle Game Engine

An open-source 3D and 2D game engine written in Object Pascal and built with Free Pascal, used for cross-platform game development on desktop, mobile, and console targets.

Double Commander

An open-source cross-platform file manager inspired by Total Commander, written in Free Pascal using the Lazarus framework.

PeaZip

A free, cross-platform archive manager written in Free Pascal and Lazarus, supporting numerous archive formats on Windows, Linux, and BSD.

Education and Legacy Pascal Code

Free Pascal is widely used by schools, hobbyists, and former Turbo Pascal developers to compile and maintain legacy Turbo Pascal and Delphi codebases on modern operating systems.

Language Influence

Influenced By

Pascal Turbo Pascal Object Pascal Delphi Extended Pascal

Influenced

Lazarus Castle Game Engine

Running Today

Run examples using the official Docker image:

docker pull freepascal/fpc:latest

Example usage:

docker run --rm -v $(pwd):/app -w /app freepascal/fpc:latest sh -c 'fpc hello.pas && ./hello'
Last updated: