GNU Pascal

From Free Pascal wiki
Jump to: navigation, search

English (en) français (fr)

GNU Pascal (GPC) is the official Pascal compiler of the GNU project. It is compatible to Standard Pascal as defined in ISO 7185, and it implements "most" of the ISO 10206 Extended Pascal standard.

Unlike Free Pascal, GPC is not self-hosted, i.e. it is not able to translate and build itself. Rather, it acts as a frontend to GNU Compiler Collection (GCC), so that Pascal code is translated to C and from C to machine language.

This has the advantage that it is instantly portable to any platform the GCC compiler supports. However, since GNU Pascal is not more than a frontend, it does have to adapt to every major change that is done to GCC. Therefore, new major versions are adopted only slowly.

Free Pascal is expected to generate more efficient machine code than GPC.


Free Pascal and GNU Pascal - a comparison

Aim:

  • Free Pascal tries to implement a Borland compatible pascal compiler on as many platforms as possible.
  • GNU Pascal tries to implement a portable pascal compiler based on POSIX.

Version:

  • Currently, Free Pascal is at version 3.0.2 (February 2017).
  • GNU Pascal is stopped version 2.1 (from 2002, which can be built with several different GCC's as backend; their Mac OS X version is an exception though, as it follows the GCC version number).

Tracking:

  • Between releases, development versions of FPC are available through daily snapshots and the source via SVN.
  • GPC issues a set of patches to the last version a few times a year, and there are regular snapshot for OS X and Windows, made by users.

Operating systems:

  • Free Pascal runs on a large number of platforms, inlcuding DOS (16/32-bit), Win32 (no UNIX porting layer needed), Linux, FreeBSD, NetBSD, OS/2, BeOS, Mac OS X, on the following architectures: x86 (32 and 64 bit), SPARC, PowerPC (32 and 64 bit), ARM, Java Virtual Machine (under development), and MIPS (under development).
  • GNU Pascal runs basically on any system that supported by GCC, and for which the build process was verified.

Bootstrapping:

  • FPC requires a suitable set of binutils (AS, AR, LD) on some platforms, GNU make and a command line bootstrap compiler. New architectures/OSes are cross-compiled.
  • GPC bootstraps via a suitable version of GCC, and requires a full set of binutils, flex, bison, gmake, a POSIX shell and libtool .

Sources:

  • Free Pascal is entirely written in Pascal, while
  • GNU Pascal is written in C (it's an adaptation of the GNU C compiler)

Language:

  • Free Pascal supports the Borland Pascal dialect, implements the Delphi Object Pascal language, Objective-Pascal and has some support for ISO 7185 Pascal and Mac Pascal extensions.
  • GNU Pascal supports ISO 7185, ISO 10206 and (most of) Borland Pascal 7.0

Extensions:

  • Free Pascal implements method, function and operator overloading (later Delphi versions have also added these, so strictly they are not extensions anymore)
  • GNU Pascal implements operator overloading.

License:

  • Both compilers come under the GNU GPL.

Author:

  • Free Pascal was started by Florian Klämpfl, Germany (florian@freepascal.org),
  • GNU Pascal was started by Jukka Virtanen, Finland (jtv@hut.fi).








External links

Various Pascal Compilers:
AAEC Pascal | Alice Pascal | Apple Pascal | Borland Pascal | Clascal | Delphi | Free Pascal (FPC) | GNU Pascal | Kylix | Lisa Pascal | Mac Pascal | Metrowerks Pascal | NBS Pascal | OMSI Pascal | P32 | Sibyl | Smart Pascal | Stanford Pascal Compiler | Swedish Pascal | THINK Pascal | Turbo Pascal | UCSD Pascal | VAX Pascal | Virtual Pascal | winsoft PocketStudio
An extensive list of compilers is maintained at Pascaland.