Once upon a time, I wrote a few programs in Pascal. It used to be the Computer Science AP language as well... Fortunately, Pascal is supported on GNU/Linux distos through the Free Pascal Compiler. You can install it on the Raspberry Pi via:
apt-get install fpc
Here is the detailed description:
#apt-cache show fpc
Maintainer: Pascal Packaging Team <firstname.lastname@example.org>
Depends: fpc-3.0.0 (= 3.0.0+dfsg-11+rpi1+deb9u1), fp-docs-3.0.0, fp-utils-3.0.0
Description: Free Pascal - SDK suite dependency package
The Free Pascal Compiler is an Object Pascal compiler supporting both Delphi
and Turbo Pascal 7.0 dialects, as well as Mac Pascal dialects. It provides a
completely portable RunTime Library (RTL) available on many platforms and
compatible with Turbo Pascal, along with a platform-independent class-based
Free Component Library (FCL) adding many Delphi extensions and interfacing
with many popular open source libraries.
Extensions have been added to the language, such as function overloading,
creation and linking of shared libraries, and Delphi language extensions
including classes, exceptions, ANSI strings, and open arrays.
This dependency package always depends on the latest available version of
the metapackage pulling in all the FPC packages provided for this
architecture. Experienced users may instead prefer to install the particular
packages they require by hand.
The executable format in GNU/Linux is the
.elf file format. However, most compiled executable programs have no extension. Any file can be executed if its execute bit is set in the file permissions. Usually a compiled program will have its execute bit set automatically by the compiler/linker. However, if you compile a Pascal program and it doesn't execute even after compiling without errors, you may need to set the execute bit as follows:
chmod +x program_name
You will then be able to run the compiled Pascal program by typing its full path... something like this:
There are some shortcuts for path names. However, using the full path should be more error free for a beginner on UNIX like operating systems.
I recommend reading through the Free Pascal Documentation, since there be some changes from what you are used to in other compilers.