Pascal Programming/Getting started

Welcome to the WikiBook Pascal Programming! This book will teach you to program in Pascal, a high-level, human-readable programming language. High-level means there are abstract concepts, such as data types or control structures, which the microprocessor does not know, but the programming language provides this abstraction level. Human-readable refers to the fact that a program written in Pascal can be read like (very simple, “Neanderthalian”) English phrases. This makes Pascal particularly suitable for beginners and we hope you will appreciate this.

Prerequisites

edit

In order to successfully use this book you need to already know a few things:

  • What are and how to access and use files that are stored on a file system.
  • How to install software on your OS.
  • How to edit plain text files using a text file editor such as vi(1), MS Notepad or emacs(1). (Note: A LibreOffice or Word document is not a plain text file.)
  • What is and how to use a CLI, e. g. cmd.exe on MS Windows or the Linux terminal.

Covering these topics would be out of this book’s scope. Pascal only assumes there is some user interface (i. e. a console) and there are external entities (this usually refers to “files”). Every system, however, implements them differently, so we cannot explain them to you, nor can we say at what point you have learned enough to continue with this book.

Required software

edit

Pascal is a compiled language. That means, you need a tool, a computer program, that “translates” the human-readable Pascal source code into a sequence of Bytes the microprocessor understands. This work is done by a compiler.

Prior the 2000s there were many different compilers, but (as in 2020) there are primarily three Pascal compilers:

  • Delphi,
  • Free Pascal Compiler (FPC), and
  • GNU Pascal Compiler (GPC).

The authors suggest FPC, due to its availability (on many platforms, and free of charge) and continuous progress in development. This table provides more information about each compiler:

compiler homepage platform license extra
Delphi Embarcadero.com Windows proprietary commercial product, with IDE
Free Pascal FreePascal.org many GPL supports multiple dialects
GNU Pascal GNU-Pascal.de All that GCC supports GPL considered abandoned since the 2010
Pascal-P SourceForge Public domain ISO 7185 Level 0 only, must be compiled manually
comparison of current Pascal compilers (current means since 2000)

[Another comparison of Free Pascal and GNU Pascal]

Furthermore, you will need a program you can edit source code files with. This can be any editor (that can edit and save plain text files), but there are also dedicated suites available for programming purposes. These are called integrated development environments, in short IDE. Such IDEs provide means to write, compile, and run programs, and possibly find programming mistakes, all in one single program. Some IDEs are:

  • Delphi
  • fp(1), a text-mode IDE that is shipped with the FPC
  • Lazarus, which is related to the FPC, but more colorful

An IDE may be overwhelming if you are just starting to program. In this case we suggest to stick to simple editors, such as nano(1). It has an easy to understand user guidance system allowing you to delve in into programming right away.

A temporary alternative for your first steps may also be websites:

All of these are powered by the FPC. Be aware of what you enter on those sites.

Working with this book

edit

We suggest to create a dedicated folder for your programming exercises. Keep your source code files until you have finished with this book. If your folder becomes cluttered with all kinds of files, the FPC comes with the tool delp(1) that can delete all (Pascal-related) files other than source code files.

Next Page: Beginning
Home: Pascal Programming