A programming language is a formal sign system designed to record computer programs. A programming language defines a set of lexical, syntactic, and semantic rules that determine the appearance of a program and the actions that an executor will perform under her control.
Since the creation of the first programmable machines, mankind has come up with more than eight thousand programming languages (including non-standard, visual and esoteric languages). Each year their number is increasing. Some languages can be used only by a small number of their own developers, while others become known to millions of people. Professional programmers can speak dozens or more different programming languages.
The programming language is designed to write computer programs, which are a set of rules that allow a computer to perform a particular computing process, organize the management of various objects, etc. The programming language differs from natural languages in that it is designed for
human interaction with computers, while natural languages are used to communicate between people. Most programming languages use special constructs to define and manipulate data structures and control the computation process.
As a rule, a programming language exists in the form:
- Language standard – a set of specifications defining its syntax and semantics; a language standard can historically evolve (see standardization for more details);
- The incarnations (implementations) of the standard – the actual software that provides work according to one or another version of the language standard; such software tools vary by manufacturer, brand and version (version), release time, completeness of the standard, additional features; may have certain errors or implementation features that affect the practice of using the language or even its standard.
You will learn:
Ways to implement languages
Programming languages can be implemented as: compiled, interpreted and embedded.
A program in a compiled language with the help of a compiler (special program) is converted (compiled) into machine code (a set of instructions) for a given type of processor and then assembled into an executable module, which can be run for execution as a separate program. In other words, the compiler translates the source code of the program from a high-level programming language into binary processor instruction codes.
If the program is written in an interpreted language, then the interpreter directly executes (interprets) the source text without preliminary translation. In this case, the program remains in the original language and cannot be launched without an interpreter. The computer processor, in this regard, can be called an interpreter for machine code.
The division into compiled and interpreted languages is conditional. So, for any traditionally compiled language, such as Pascal, you can write an interpreter. In addition, most modern “pure” interpreters do not execute language constructs directly, but rather compile them into some high-level intermediate representation (for example, with dereferencing variables and expanding macros).
For any interpreted language, you can create a compiler – for example, the Lisp language, originally interpreted, can be compiled without any restrictions. The code generated during program execution can also be dynamically compiled at runtime.
As a rule, compiled programs run faster and do not require additional programs to run, as they have already been translated into machine language. At the same time, each change of the program text requires recompilation, which slows down the development process. In addition, a compiled program can run only on the same type of computer and, as a rule, under the same operating system for which the compiler was designed. To create an executable file for a different type of machine, a new compilation is required.
Interpreted languages have some specific additional features (see above), in addition, programs on them can be run immediately after the change, which facilitates the development.
A program in an interpreted language can often be run on different types of machines and operating systems without additional effort. However, interpreted programs run noticeably slower than compiled ones; in addition, they cannot run without an interpreter program.
Some languages, such as Java and C #, are between compiled and interpreted. Namely, the program is not compiled into a machine language, but into a machine-independent low-level code, byte code. Next, the bytecode is executed by the virtual machine. Interpretation is usually used to execute bytecode, although parts of it to speed up the program can be translated into machine code directly during program execution using Just-in-time compilation (JIT) technology. For Java, the bytecode is executed by the Java Virtual Machine (JVM), for C # – the Common Language Runtime.
In a sense, this approach allows using the advantages of both interpreters and compilers. It should be mentioned that there are languages that have both an interpreter and a compiler (Fort).
Low-Level Programming Languages
The first computers had to be programmed with binary machine codes. However, programming in this way is a rather laborious and difficult task. To simplify this task, low-level programming languages began to appear, which made it possible to set machine instructions in a way that was understandable to humans. To convert them to binary code, special programs were created – translators.
Translators are divided into:
- Compilers – turn the program text into machine code, which can be saved and then used without the compiler (an exImple is executable files with the * .exe extension).
- interpreters – turn part of a program into machine code, execute it, and then move on to the next part. Moreover, each time the program is executed, an interpreter is used.
An example of a low-level language is assembler. Low-level languages are focused on a specific type of processor and take into account its features, therefore, to transfer an assembler program to another hardware platform, it needs to be completely rewritten. There are certain differences in the syntax of programs for different compilers. True, the central processors for computers from AMD and Intel are practically compatible and differ only in some specific teams. But specialized processors for other devices, for example, video cards and phones contain significant differences.
Low-level languages, as a rule, are used to write small system programs, device drivers, interface modules with non-standard equipment, programming specialized microprocessors, when the most important requirements are compactness, speed and the ability to directly access hardware resources. Assembler is a low-level language that is still widely used.
High-Level Programming Languages
Features of specific computer architectures are not taken into account in them, so the created applications are easily transferred from computer to computer. In most cases, it is enough to simply recompile the program for a specific computer architecture and operating system. It is much easier to develop programs in such languages and fewer errors are allowed. Significantly reduced program development time, which is especially important when working on large software projects.
Now in the development environment, it is believed that programming languages that have direct access to memory and registers or have assembler inserts should be considered programming languages with a low level of abstraction. Therefore, most languages considered high-level languages before 2000 are no longer considered as such.
- Address programming language
- Pascal abc
- C ++
- C #
The disadvantage of some high-level languages is the large size of the programs compared to programs in low-level languages. On the other hand, for algorithmic and structurally complex programs when using supercompilation, the advantage may be on the side of high-level languages. The text of programs in a high-level language is smaller, however, if you take in bytes, the code originally written in assembler will be more compact. Therefore, mainly high-
level languages are used to develop software for computers and devices that have a large amount of memory. And different subtypes of assemblers are used to program other devices where the size of the program is critical.
Modern programming languages are designed to use ASCII, that is, the availability of all graphic ASCII characters is a necessary and sufficient condition for writing any language constructs. ASCII control characters are used to a limited extent: only CR carriage return, LF line feed and HT horizontal tabs are allowed (sometimes also VT vertical tab and go to the next FF page).
Early languages that arose in the era of 6-bit characters used a more limited set. For example, the Fortran alphabet includes 49 characters (including a space): ABCDEFGHIJKLMNOPQRSTUVWXYZ 0 1 2 3 4 5 6 7 8 9 = + – * / (). , $ ‘:
A notable exception is the APL language, which uses a lot of special characters.The use of characters outside of ASCII (for example, KOI8-R characters or Unicode characters) depends on the implementation: sometimes they are allowed only in comments and character/string constants, and sometimes in identifiers. Languages existed in the USSR where all keywords were written in Russian letters, but such languages did not gain much popularity.
The expansion of the character set is constrained by the fact that many software projects are international. It would be very difficult to work with a code where the names of some variables are written in Russian letters, others in Arabic, and others in Chinese characters. At the same time, for working with text data, new generation programming languages (Delphi 2006, C #, Java) support Unicode.
Categories of programming languages
- Procedural (imperative)
- Interface Descriptions
- Reflective (i.e. supporting reflection)
- brain teaser
- Script (script)