ArticleslgStudy

computer science

Free Pascal

Free Pascal is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Free Pascal rather than just read about it. In short: Free Pascal Compiler (FPC) is a compiler for the closely related programming-language dialects Pascal and Object Pascal. It is free software released under the GNU General Public License, with exception clauses that allow static linking against its runtime libraries and packages for any purpose in combination with any other software license.

Free Pascal — main illustration
Free Pascal — illustration

Key takeaways

  • Free Pascal belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Free Pascal to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Free Pascal from memory before moving on to harder problems.

Reference excerpt

Free Pascal Compiler (FPC) is a compiler for the closely related programming-language dialects Pascal and Object Pascal. It is free software released under the GNU General Public License, with exception clauses that allow static linking against its runtime libraries and packages for any purpose in combination with any other software license. It supports its own Object Pascal dialect, as well as the dialects of several other Pascal family compilers to a certain extent, including those of Borland Pascal (named "Turbo Pascal" until the 1990 version 6), Borland (later Embarcadero) Delphi, and some historical Macintosh compilers. The dialect is selected on a per-unit (module) basis, and more than one dialect can be used per program. It follows a write once, compile anywhere philosophy and is available for many CPU architectures and operating systems (see Targets). It supports inline assembly language and includes an internal assembler capable of parsing several dialects such as AT&T and Intel style. There are separate projects to facilitate developing cross-platform graphical user interface (GUI) applications, the most prominent one being the Lazarus integrated development environment (IDE).

Supported dialects Initially, Free Pascal adopted the de facto standard dialect of Pascal programmers, Borland Pascal, but later adopted Delphi's Object Pascal. From version 2.0 on, Delphi compatibility has been continuously implemented or improved. The compiler can operate in different modes, for example the developers made it clear that they would incorporate working patches for the standardized dialects of the American National Standards Institute (ANSI) and International Organization for Standardization (ISO) to create a standards-compliant mode. A small effort has been made to support some of the Apple Pascal syntax to ease interfacing to the Classic Mac OS and macOS. The Apple dialect implements some standard Pascal features that Turbo Pascal and Delphi omit. The 2.2.x release series did not significantly change the dialect objectives beyond roughly Delphi 7 level syntax, instead aiming for closer compatibility. A notable exception to this was the addition of support for generics to Free Pascal in version 2.2.0, several years before they were supported in any capacity by Delphi. In 2011 several Delphi 2006-specific features were added in the development branch, and some of the starting work for the features new in Delphi 2009 (most notably the addition of the UnicodeString type) was completed. The development branch also has an Objective-Pascal extension for Objective-C (Cocoa) interfacing. Beginning with version 2.7.1, Free Pascal added support for ISO Pascal. As of version 3.0.0, it has been able to compile standardpascal.org's P5 ISO Pascal compiler with no changes.

History

Early years Free Pascal was created when Borland clarified that Borland Pascal development for MS-DOS would stop with version 7. Student Florian Paul Klämpfl began developing his own compiler written in the Turbo Pascal dialect which produced 32-bit code for the GO32v1 DOS extender, (developed and used by the DJ's GNU Programming Platform project). Originally, the compiler was a 16-bit executable compiled by Turbo Pascal. After two years, the compiler was able to compile itself into a 32-bit executable.

Expansion The initial 32-bit compiler was published on the Internet, and the first contributors joined the project. Later, a Linux port was created by Michael van Canneyt, five years before the Borland Kylix Pascal compiler for Linux became available. The DOS port was adapted for use in OS/2 using the Eberhard Mattes eXtender (EMX) which made OS/2 the second supported compiling target. As well as Florian Klämpfl the original author, Daniël Mantione also contributed significantly to make this happen, providing the original port of the run-time library to OS/2 and EMX. The compiler improved gradually, and the DOS version migrated to the GO32v2 extender. This culminated in release 0.99.5, which was much more widely used than prior versions, and was the last release aiming only for Borland Pascal compliance; later releases added a Delphi compatibility mode. This release was also ported to systems using Motorola 68000 family (m68k) processors. With release 0.99.8 the Win32 target was added, and a start was made with incorporating some Delphi features. Stabilizing for a non-beta release began, and version 1.0 was released in July 2000. The 1.0.x series was widely used, in business and education. For the 1.0.x releases, the port to 68k CPU was redone, and the compiler produced stable code for several 68k Unix-like and AmigaOS operating systems.

Version 2 During the stabilization of what would become 1.0.x, and also when porting to the Motorola 68k systems, it was clear that the design of the code generator was far too limited in many aspects. The principal problems were that adding processors meant rewriting the code generator, and that the register allocation was based on the principle of always keeping three free registers between building blocks, which was inflexible and difficult to maintain. For these reasons, the 1.1.x series branched off from the 1.0.x main branch in December 1999. At first, changes were mostly clean-ups and rewrite-redesigns to all parts of the compiler. The code generator and register allocator were also rewritten. Any remaining missing Delphi compatibility was added. The work on 1.1.x continued slowly but steadily. In late 2003, a working PowerPC port became available, followed by an ARM port in summer 2004, a SPARC port in fall 2004, and an x86-64-AMD64 port in early 2004, which made the compiler available for a 64-bit platform. In November 2003, a first beta release of the 1.1.x branch was packaged and numbered 1.9.0. These were quickly followed by versions 1.9.2 and 1.9.4; the latter introduced OS X support. The work continued with version 1.9.6 (January 2005), 1.9.8 (late February 2005), 2.0.0 (May 2005), 2.0.2 (December 2005), and 2.0.4 (August 2006).

… excerpt ends here. Continue reading the full article.

Illustrations

Free Pascal illustration
Free Pascal: Lazarus IDE in Windows 10
Lazarus IDE in Windows 10
Free Pascal: MSEide+MSEgui
MSEide+MSEgui
Free Pascal: Free Pascal IDE in Linux showing "Hello, World!" program in German
Free Pascal IDE in Linux showing "Hello, World!" program in German

Worked examples

Example 1 — a first encounter with Free Pascal

Start with the simplest possible case. Write down what Free Pascal claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Free Pascal before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Free Pascal ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Free Pascal

In research
Free Pascal appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Free Pascal in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Free Pascal is common in secondary-school and first-year university syllabi. It links to neighbouring topics Classic Mac OS software, Compilers, Cross-platform free software, so understanding it makes those chapters shorter.
In everyday life
Look for Free Pascal outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Free Pascal” →

How to study Free Pascal in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Free Pascal means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Free Pascal out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Free Pascal in simple terms?

Free Pascal Compiler (FPC) is a compiler for the closely related programming-language dialects Pascal and Object Pascal. It is free software released under the GNU General Public License, with exception clauses that allow static linking against its runtime libraries and packages for any purpose in…

Why does Free Pascal matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Free Pascal?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Free Pascal.

Tags

  • Classic Mac OS software
  • Compilers
  • Cross-platform free software
  • Cross-platform software
  • Free Pascal
  • Free and open source compilers
  • Free software programmed in Pascal
  • Linux programming tools
  • MacOS programming tools
  • MorphOS software
  • Object-oriented programming languages
  • Pascal (programming language)

Keep exploring