Pascal. Development of programs on a PC. Stages of preparing a program on a PC. Compilers and Interpreters

Development of programs on a PC. Stages of preparing a program on a PC. Compilers and Interpreters


Search other websites:

 1. Development of programs on a PC. Features. Pascal Development Tools

To create programs on a computer, special programs are used that are based on some well-known programming language. Such programs are called by different names: software development tools, tool systems, visual application development systems, etc. Modern software development tools include:

  • support for several high-level languages;
  • debugging systems;
  • technological programming complexes;
  • intelligent editing technologies or refactoring;
  • compilation and debugging technologies in several programming languages;
  • technologies for working with databases;
  • technologies for creating Web-based applications;
  • technologies of design patterns;
  • modeling technologies using the UML language;
  • other useful innovations.

Software development tools (programming tools) are of two main types:

  • compilers;
  • interpreters.

Accordingly, programming languages are divided:

  • interpreted programming languages (Python, Java Script, Basic and others);
  • compiled programming languages (C++, C#, Java, Pascal and others).

Examples of well-known software development tools include Microsoft Visual Studio, Java Eclipse, Lazarus, Delphi, Intellij IDEA, and others. In the Pascal programming language, the most well-known development tools are the Lazarus and Delphi family of systems.


2. Compilers and interpreters. Features. Differences

As you know, compilers and interpreters are distinguished among software development tools. These types of software differ in the way they generate machine code, which is a set of instructions for the processor. The differences are as follows.

The interpreter checks one command after another. If a syntax error is detected, program execution is paused. If there is no error, then the command is executed and it proceeds to check the next command. Thus, all commands are processed. Even if the program is already checked and does not contain changes, then each time the program is started, the interpreter will check any of the commands in a new way. The interpreter does not generate intermediate object files.

The compiler checks all commands for syntax errors without stopping. If there are errors, then a list of commands with errors is generated. At this stage, the program is not ready for execution and an intermediate object file has not been generated. If there are no errors, the compiler generates an intermediate object file. This file will be used in the future if the program needs to be run several times. Based on this object file, an executable file is created that contains instructions in machine codes. If changes are made to the text of the compiled program, the process of checking commands for errors, creating an object file and creating an executable file will be repeated.


3. Stages of preparing a program on a PC

When creating program code in some programming system, the programmer must adhere to strictly defined steps.

When creating a program in a compiler in the Pascal programming language (Delphi, Lazarus, Turbo Pascal), the following steps are distinguished:

  1. Editing. Typing a program in a high-level language and saving it on an external storage device. The generated file is called the source module, which contains the so-called source code of the program. For example, if you create a program in the Pascal programming language, then, as a rule, the source code is saved in files with the * .pas extension.
  2. Compilation. At this stage, a special program (compiler) translates the program from a text view into an intermediate object code. During compilation, the program searches for errors in the program and corrects them. The file created during compilation is called the object module. If you try to read the code of this module as a text file, then it will be incomprehensible to the user. For example, in a Delphi programming system, object modules have the extension *.dcu.
  3. Linkage. At this stage, all the necessary programs are collected into a single, bootable module suitable for execution on a PC. This module is called executable and is presented as a separate file. Typically, an executable module has the extension *.exe. This module is the result of work, you can run it, use it in your work.
  4. Execution. This is the operation phase of the program. If errors (logical) are found as a result of the program execution and analysis of the results of its work, the program needs to be finalized. In this case, the entire development process is repeated from the editing stage.


4. Simplified Compiler Model

In a simplified version, the compiler contains the following components:

  • lexical analyzer – breaks down tokens into high-level program code. The breakdown is performed on the basis of separator characters;
  • parser – converts a sequence of tokens received from a lexical analyzer into a sequence of internal compiler codes. The parser uses the syntax rules of the grammar of the language to verify the correctness of the recording sentences of the program;
  • code generator – translates the internal code of the compiler into the final machine code of the computer;
  • tables in which reserved words, identifier names, literals are stored.

The figure shows a simplified compiler model.

Pascal. Simplified compiler model

Figure. Simplified compiler model