Are You Old Enough To Remember PASCAL?

Website Developer
8 min readDec 25, 2020

In the mid and late 1970s, Pascal programming language was developed to teach programming to young and upcoming computer scientists. Today, the programming language has been replaced by more complex programming languages, including C, C++, Java, and Python. Despite its unpopularity, the language is still used in some institutions to introduce people to programming. Pascal is a structured and procedural language that requires considerable attention to details, sequence, and structure. However, the language is less prevalent in the software development department compared to C, C++, Python, and Java. As noted earlier, the language was primarily developed to teach students and make efficient programs that could run on computers available at that time.

PLATFORMS

Like any other programming language, Pascal is made up of data and actions that specify what the data should do. The language consists of descriptions of the actions that need to be performed. Data is also described within the language’s syntax. The data is manipulated by the actions to generate a sequence or output. Every programming language needs a compiler to interpret these declarations, also known as instructions, to meaningful output. In the early 1980s, Pascal was developed for the DOS operating system. It utilized a simple compiler with the language itself adopting ALGOL 60 syntax. Pascal was capable of defining complex datatypes and dynamic structures. Unlike its successor, the C and C++ programming languages, Pascal could represent any nested declaration. Also, many statements could be made inside a substructure or function.

Pascal’s success was made possible by the architecture of the mini and microcomputers of the 1970s. These computers comprised simple 16, 32, or 64-bit architectures and ran on DOS. However, as computers evolved and adopted the UNIX-based operating system, Pascal lost its superiority. Simultaneously, the C and C++ programming languages were released, replacing Pascal in every aspect of the computing paradigm. Regardless, Apple computers improved Pascal’s initial design and developed Object Pascal. The new language depicted the onset of object-oriented programming for Apple computers. Object Pascal was further refined into Delphi to be adopted by the Windows operating platform.

As earlier noted, compilers are necessary to convert coded instructions into results. Early Pascal compilers were written in the language itself and ported into early mainframe computers. The compiler was capable of recompiling itself when it was ported into another platform or new features added to the programming language. Successful Pascal compilers included new add-ons that increased the compiler’s effectiveness to interpret complex data types and structures. These early compilers later evolved to the Pascal P-system, comprising Pascal P1, P2, P3, and P4 (“UCSD P-System”). Pascal-P1 was the first to be created, and its subsequent compilers refined the code and interpreter that came with it. These compilers increased their efficiency and included new features for full Pascal compatibility.

BENEFITS AND DOWNSIDES

Undoubtedly, each programming language has its advantages and drawbacks that give it an edge over the others. Pascal is a clean language that is easily readable compared to the C programming language. Its maintainability makes the language a more powerful one similar to its modern predecessors like C and C++. Unlike other languages, Pascal does not utilize a makefile. In essence, a makefile is a predefined set of instructions that can be executed. While most other programming languages contain a makefile, Pascal’s compiler assumes the files that need to be recompiled for certain programs. Simultaneously, Pascal compilers are swift and fast, regardless of the size of the program being compiled. The quickness allows the program to run smoothly unless errors are present in the code.

When compared with other languages, Pascal’s programs utilize less memory and compile fast. With its utilization of Free Pascal, a modern compiler, Pascal code can be compiled at high speed, making it one of the fastest programming languages currently available. Unlike C, Pascal does not have a unique identifier across the entire program. Instead, each unit in Pascal is given its namespace. Additionally, Free Pascal is compatible with most Integrated Development Environments (IDEs). The language’s compatibility with these IDE platforms allows for a better programming experience. The user can employ any IDE and write, compile, and debug any Pascal code with ease. While the language was designed to teach people how to program, Pascal is also a significant tool for programming experts who want to explore more.

Current programmers explore object-oriented programming tools. Pascal, through Object Pascal and Turbo Pascal, allows such programmers to utilize the vast array of object libraries and tools available. Moreover, its integration with database programs makes it a more viable option in commercial software development. Further, the Pascal code compiled in one Linux distribution can run on any other distribution. The Linux distribution independence makes it easier for Pascal programmers to create software compatible with all other platforms within the Linux family. Lastly, unlike other Pascal compilers, Free Pascal is compatible with most other platforms and Pascal source code, including the Delphi source code.

Despite the advantages Pascal has in the programming world, several drawbacks limit its usability, efficiency, and effectiveness as a compiler and software development tool. Pascal is an old programming language, and its integration with modern programming environments presents a challenge. Moreover, it is difficult to adjust programs written in Pascal to work in current IDEs. Graphics produced by Pascal look very simple and similar to those seen more than a decade ago. Existing programming languages are capable of generating complex graphics and user interfaces. Ultimately, these drawbacks undermine the ability of Pascal to compete among other languages in the market. C, C++, Java, PHP, Python, and other modern languages pack extensive libraries and programming tools that overshadow Pascal’s capabilities.

EXAMPLES OF CODE

Code Comparison with Python. Both Pascal and Python do not share a similar coding structure, as will be shown below. The first step to learning programming is creating a simple program that displays certain words set in the program code. The program is often a test of seeing whether the programming environment is ready. A program displaying the words “Hello World” is usually the first code for any programmer. In pascal, the “Hello World” code will follow a specific structure that will also be explained in detail. The same case will apply to Python`s “Hello World” code.

Hello World in Pascal

program HelloWorld;

uses crt;

(* Here the main program block starts *)

begin

writeln(‘Hello, World!’);

readkey;

end.

When the code is compiled, “Hello, World” would be the output. The first line in the program denotes the name of the program to be executed. The uses crt; command in the second line represents a pre-processor. The command informs the compiler to access the crt unit that will form part of the program. The block of code enclosed between the begin and end statements is the main program. Pascal follows this syntax in every program. Unlike other programming languages, the end statement is accompanied by a full stop rather than a semi or full colon. Execution of the program starts at the begin statement.

Comments are denoted by (*…*), and the compiler ignores them. Comments are usually put to add more clarity to the user. They have no other function in the program. The writeln(); statement tells the compiler to output the information present within the braces. The function is among many other functions within Pascal that serve a specific function. The readkey; is part of the crt unit and requires the user to press any key to end the program. The last statement denotes the end of the program.

Hello World in Python

# This program prints Hello, world!

print(‘Hello, world!’)

Python is a straightforward programming language that is easy to learn and code. Moreover, its across-platform programming language and can run in several environments, including Windows, macOS, and Linux. Before writing the Hello World program, one must ensure that all Python prerequisites are installed into the computer. These prerequisites include a preferred programming environment to run python and Python 3. The ‘#’ statement is a comment telling the reader what the program is all about. The print() function is inbuilt and defines what the code will output. In python, users can also create and define their functions deepening on what programs they are writing. Characters inside the parenthesis are referred to as strings, and the system will display all the strings between the parenthesis.

IF STATEMENT

If statements are used to express two Boolean expressions. For instance, if one condition is true, then the other is false. In Pascal, the if statement can have an additional else condition that executes another condition.

If condition then statement 1 else statement 2;

If the condition is true in the above structure, then statement 1 is executed, and statement 2 skipped. Otherwise, statement 1 is skipped, and statement 2 executed:

if color = black then

writeln(‘You have selected a black shirt)

else

writeln(‘Please choose a shirt with a different color’);

In the above example, the first statement will be executed if the condition is true. If it is false, the else statement will instead be executed. The if-else statement can also incorporate other if-else statements within the program code to test various conditions.

LOOP

In certain situations, one can be required to create a program that executes a block of code several times. More often, statements are executed sequentially, with the first statement being executed before the next follows (“Pascal — Loops.”). With such complexities, Pascal also provides control structures that aid in executing complex programs. Pascal loop contracts include the while-do loop, for-do loop, repeat-until loop, and nested loop. All these loops perform the same function, except for the sequence of executions within the loop. For instance, the while-do loop first performs a check on the condition and executes the statements multiple times as long as it is true. The for-do loop allows the programmer to write a repetitive code that executes a specific number of times. The repeat-until loop is similar to a while-do loop, except the condition is tested last. Examples of loops include:

1) While-do loop

while number>2 do

begin

sum := sum + number;

number := number + 1;

end;

2) For-do loop

for i:= 1 to 7 do writeln(i);

3) Repeat-until loop

repeat

sum := sum + number;

number := number + 1;

until number = 0;

TRENDS

Since C, C++, Java, and other programming languages became more popular, Pascal has relatively little attention from programmers. As such, there have not been many trends within the programming language. Most of the software developing companies seek applicants who are conversant with modern programming languages. Unlike C and C++ programming languages, Pascal has become less popular due to the changing programming environment and the availability of more powerful languages.

During the 1970s, Pascal became a revolutionized programming language that received much attention from programmers. The language was designed to teach students to program. As a procedural language, Pascal shares similar acronyms with differences seen in the syntax and statement constructs. Regardless, Pascal has been a gateway to greater and more powerful programming languages and is still used today to teach programming. Despite its simplicity, the programming language is not compatible with the modern programming environment. Ultimately, learning Pascal can help one get a foothold on basic programming.

--

--