programming language
A programming language is a formal language for the formulation of data structures and algorithms , i. H. of calculation rules that can be carried out by a computer . They usually consist of step-by-step instructions from permitted (text) patterns, the so-called syntax .
While the first programming languages were still geared directly to the properties of the respective computer, today mostly problem-oriented or (more generally) higher-level programming languages are used, which allow a more machine-independent and therefore easier to understand form of expression for humans. Programs written in these languages can be automatically translated into machine language, which can be executed directly by a processor . Visual programming languages are also increasingly being used to facilitate access to programming languages.
In declarative programming languages , the execution algorithm is already defined in advance and is not formulated / described in the source text, but only its (initial) values, (boundary) conditions and rules are specified, which the (final) result must meet.
Overview
The instructions often generated in a certain programming language using simple text editors are called source text (or source code). In order to be executed on a computer, the source text must be translated into the machine language of this computer (type). In contrast to higher programming languages and assembly language, this is a binary code that is difficult for humans to read. When programming in machine language is spoken of, today it is mostly assembly language that is meant.
The translation into machine language can be done either before execution by a compiler or - at runtime - by an interpreter or JIT compiler . A combination of both variants is often chosen, in which the source text of the programming language used is first translated into an intermediate code , which is then converted into machine code at runtime within a runtime environment . This principle has the advantage that the same intermediate code can be executed on different platforms. Examples of such an intermediate code are the Java bytecode and the Common Intermediate Language .
Programming languages usually offer at least
- Input / output commands so that the program can receive information (more precisely: data ) and output it again;
- Declaration of variables and fields in order to be able to (temporarily) store information;
- basic and standard mathematical functions;
- Basic functions for character string processing;
- Control instructions for conditional execution , repetition , program subdivision (e.g. in sub-functions ) as well as integration of libraries .
It is usually possible to create higher functions from these basic functions and to encapsulate them as a reusable library. Getting from there to a higher level or problem-oriented language is no longer a big step. So there was soon a large number of special languages for a wide variety of applications. This increases the efficiency of the programmer and the portability of the programs, usually the processing speed of the programs generated decreases, and the power of the language decreases: the higher and more comfortable the language, the more the programmer is bound to the paths provided in it to tread.
Languages are successful in different ways - some “grow” and are increasingly used; again and again languages have been designed with the claim to be multi-purpose and broadband languages, often with modest success ( PL / 1 , Ada , Algol 68 ). Different services try to measure the spread of different languages; known are, for example, the TIOBE index , PYPL and the analyzes by RedMonk.
panorama
The importance of programming languages for computer science is also expressed in the variety of forms and breadth of applications.
- Machine language , assembly languages or C allow hardware-related programming.
- Higher programming languages allow more comfortable, faster programming.
- Script languages are used for simple control of computers, as in batch processing .
- Languages with visual programming environments facilitate the graphic design of user interfaces .
- Esoteric programming languages are experimental languages with unusual programming concepts and / or consideration of non-topic aspects, e.g. B. aesthetic appearance of the source code.
- Graphic programming languages should offer particularly easy access to programming; instead of writing source text, the program can be clicked together from processing blocks.
- Mini-languages should introduce children to programming at an early age (not to be confused with minilanguages , a synonym for domain-specific languages ).
Colloquially, programming languages are also used in other areas. However, the following languages are not designed for the description of algorithms and general data processing, i.e. no general purpose languages :
- Markup languages are used for formatting texts and files .
- CNC programming languages are (or are used to generate) control information for machine tools.
- Database languages are intended for use in and querying databases .
- Page description languages and other description languages (e.g. VHDL) are an imperative form of a file format .
- Style sheet languages are used to determine the appearance
Such languages fall under the domain-specific languages .
Instruction categories
The instructions of programming languages (see examples here ) can be classified into the following groups:
- Input and output commands - read data from the keyboard, from a file or from other sources or output them to / via a specific output device (screen, file, printer, ...).
- Assignments and calculations - change or create data content.
- Control structures - based on the available data, decide which commands are to be executed next.
- Declarations - reserve memory space for variables or data structures under an almost freely selectable name. You can use this name to address them later.
- Calls of “program-external” subroutines / modules such as system functions (e.g. “Read”) or functional modules, also from other programming languages.
translator
In order to be able to execute a program created in a certain programming language, an equivalent sequence of machine instructions must be executed instead of its source code . This is necessary because the source code consists of character strings (e.g. "A = B + 100 * C") that the processor does not "understand".
The leaps in development that occurred in the history of computer technology and software technology also brought with them different tools for generating machine code, possibly over several stages. These are called compilers , interpreters , precompilers , linkers, etc., for example .
With regard to the way and the point in time at which the computer arrives at an equivalent machine code, two principles can be distinguished:
- If a program text is "translated" as a whole , i.e. a machine program is created from the source text, the translation mechanism is referred to as a compiler. The compiler itself is a program that reads the program source code as data input and delivers the machine code (e.g. object code, EXE file, “executable”) or an intermediate code as data output.
- If, depending on the program text, corresponding machine code blocks are executed during execution , this is called an interpreted language. The program is interpreted in a runtime environment (e.g. outdated JVM ) and, depending on the program command, a corresponding machine command block is executed.
There are also various mixed variants :
- With “just-in-time compilation”, the program text is recompiled directly before each program run; If necessary, individual program sections are only compiled during the (interpreted) program run.
- In some cases, compilers generate a program code that cannot be executed yet, which is converted into executable machine code by subsequent system programs . A distinction must be made here between the concepts of “platform-independent intermediate code ” (e.g. in the context of software distribution ) and “platform- bound object code ” (is linked together with other modules to form executable code, sometimes called a load module ).
- With precompilers , special syntax constructs not provided for in the programming language itself (e.g. decision tables ) can be processed and, pre-translated into the selected programming language, inserted in the source code.
To control the translation, the source text can contain additional special compiler instructions in addition to the instructions of the programming language . Complex translation processes are controlled by a project creation process and the parameters set therein when certain programming languages / development environments are used .
history
From a practical point of view, the prehistory of the programming languages includes the numerous notations that were developed both in telecommunications technology ( Morse code ) and for controlling machines ( jacquard loom ); then the assembly languages of the first computers, which were only their further development. From a theoretical point of view, this includes the many refinements of the concept of algorithm , of which the λ-calculus is by far the most important. Also Zuse Plankalkül belongs here, for he is the minimalist approach of theorists committed ( bit as is essential).
In a first phase, countless languages were developed from the mid-1950s that were practically oriented to given tasks and resources. Since the development of Algol 60 (1958–1963), the task of translator construction has been established in practical computer science and is initially worked on intensively with a focus on syntax (recognition, parser ). On the practical side, extended data types such as compounds , character strings and pointers have been introduced (consistently e.g. in Algol 68 ).
In the 1950s, the first three more widely used, practical, high-level programming languages were developed in the United States . In doing so, they pursued both imperative and declarative - functional approaches.
The development of Algol 60 ushered in a fruitful phase of many new concepts, such as that of procedural programming . The need for new programming languages has increased due to the rapid advancement of computer technology . In this phase, the still popular programming languages emerged BASIC and C .
In the follow-up period from 1980, the newly developed logical programming languages could not prevail against the further development of traditional concepts in the form of object-oriented programming . The Internet , which grew ever faster in the 1990s , took its toll, for example in the form of new scripting languages for the development of web server applications.
The integration of the concepts of the last decades is currently progressing. For example, the aspect of code security in the form of virtual machines is receiving greater attention . Newer integrated, visual development environments require significantly less time and money. User interfaces can usually be designed visually, code fragments can be reached directly with a click. Documentation on other program parts and libraries can be viewed directly; there is usually even a lookup function that finds out while you are writing which symbols are allowed at this point and makes appropriate suggestions ( auto-complete ).
In addition to the now established object-oriented programming , the model-driven architecture is another approach to improving software development , in which programs are generated from syntactically and semantically formally specified models. At the same time, these techniques mark the transition from a more handcrafted, individual art to an industrially organized process.
- Language generations
The machine, assembly, and high-level programming languages have also been referred to as first to third generation languages ; also in analogy to the simultaneous hardware generations. As the fourth generation , a wide variety of systems were advertised, with program generators and auxiliary programs such. B. for the design of screen masks ( screen painter ) were equipped. The language of the fifth generation should eventually in the 1980s in terms of the Fifth Generation Computing Concurrent Prolog be.
Programming paradigms
Surname | functional | imperative | object-oriented | declarative | logical | concurrent |
Ada | X | X | X | |||
C. | X | |||||
prolog | X | X | ||||
Scheme | X | X | (X) | X | (X) | |
Haskell | X | (X) | X | (X) | ||
Scala | X | (X) | X | (X) | X |
The programming languages can be divided into categories that have formed in the evolutionary course of programming language development as so-called programming paradigms . The paradigms of structured , imperative and declarative programming are fundamental - each with further subdivisions. However, a programming language can also obey several paradigms, that is, support the concept-defining features of several paradigms.
Structured programming languages
Structured programming also became popular in the early 1970s due to the software crisis. It includes the breakdown of a program into subroutines ( procedural programming ) and the restriction to the three elementary control structures instruction - sequence , branching and repetition .
Imperative programming languages
A program written in an imperative programming language consists of instructions (Latin: imperare = command) that describe how the program generates its results (for example if-then sequences, loops, multiplications, etc.).
Declarative programming languages
The declarative programming languages follow exactly the opposite approach . The programmer describes which conditions the output of the program (the what ) must meet. How the results are actually generated is determined during the translation , for example by an interpreter. One example is the database query language SQL .
A program doesn't have to contain a list of instructions. Instead, graphic programming approaches , for example as with the STEP 7 platform used in automation , can be used.
The types of conditions that are formulated are subdivided by the declarative programming languages into logical programming languages that use mathematical logic and functional programming languages that use mathematical functions .
Object-oriented programming languages
Here, data and commands that can be applied to this data are combined in objects. Object orientation is used in object-oriented programming to reduce the complexity of the resulting programs.
The building blocks that make up an object-oriented program are called objects. The conception of these objects is usually based on the following paradigms :
- Polymorphism
- Ability of an identifier to accept different data types depending on how it is used.
- Data encapsulation
- In programming, data encapsulation is the hiding of implementation details.
- Inheritance
- Inheritance means, in simplified terms, that a derived class also has the methods and attributes of the base class, i.e. inherits .
Type system
Variables are named locations in memory that can hold a value. In order to determine the type of stored value, a data type must be assigned to the variable in many programming languages . Frequent data types are integers and floating point numbers or strings.
A distinction is made between typed and typeless languages. In typed languages (for example C ++ or Java ) the content of the variable is determined by a data type. There are different data types for integers and floating point numbers that differ in their value range. They can be unsigned or signed. In ascending order of values, these are, for example: Short, Integer or Long. Data types for floating point numbers are, for example, float or double. Individual characters can be saved in the Char data type . The data type String is available for character strings .
The typed languages can be differentiated based on the time of the type check. If the type check already takes place when the program is compiled, it is called static typing . If the type check takes place at runtime, one speaks of dynamic typing . If a programming language detects type errors at runtime at the latest, it is called type-safe .
With static type checking, the programmer is tempted to circumvent this or it is not fully enforced (at the current state of the art, there must be a way in every static language to generate typeless data or to switch between types - for example when reading data from the mass storage device become). In languages with dynamic type checking, some type errors are only found when it is too late. If the data type of a variable is to be changed, an explicit conversion command is required.
The typeless languages (for example JavaScript or Prolog ) do not have any differentiated data types, in contrast to the typed languages. The data type of a variable is only determined at runtime. If a value of a different type is assigned to a variable, the variable is converted to the new type. The typeless languages often treat all units as character strings and know a general list for compound data.
The definition of the data type has two main purposes:
- Descriptive type specifications make programming easier and relieve the notation. When accessing a field with an index, the memory location at which the queried value is located can be calculated depending on the data type used.
- Prescriptive type specifications exclude certain operations. For example, compliance with field boundaries can be checked in order to prevent access beyond the field boundaries.
The secure type system of the ML programming language forms the basis for the correctness of the evidence systems programmed in it (LCF, HOL, Isabelle ); In a similar way, attempts are now being made to ensure the security of operating systems . After all, only different type specifications enable the popular overloading of identifiers. According to Strachey , the type system should be at the center of defining a programming language.
The definition of data is generally performed by specifying a specific specification for data storage and of the necessary operations. This specific specification defines the general behavior of the operations and thus abstracts from the specific implementation of the data structure (see also declaration ).
Often the citizens first class ( First class Citizens are thus the forms of data that can be used directly detected, which obeys paradigm language - - FCCs) a programming language. In Java e.g. B. Objects are FCCs, in Lisp every piece of program is FCC, in Perl it is strings, arrays and hashes. The structure of the data also follows syntactic rules. With variables one can easily access the data and use the dual character of reference and date of a variable. In order to be able to use the character strings of the data with their (semantic) meaning, this meaning must be specified by specifying a data type . Usually there is also the possibility of agreeing new types within the scope of the type system . LISP uses lists as the main conceptual structure. The program is also a list of commands that modify other lists. Forth uses stacks and stack operations as the main conceptual structure, as well as a dictionary of definitions that can be expanded at runtime, and in most implementations does not do any type checking at all.
Others
A popular entry into a programming language is to use it to output the text Hello World (or German “Hallo Welt”) on the screen or another output device (see Hello World program ). Accordingly, there are lists of hello-world programs and their own websites that compare solutions in different programming languages.
See also
- List of programming languages
- Timeline of the programming languages
- Education-oriented programming languages
literature
- Friedrich L. Bauer , Hans Wössner: Algorithmic Language and Program Development . 2nd improved edition. Springer, Berlin et al. 1984, ISBN 3-540-12962-6 .
- Peter A. Henning, Holger Vogelsang: Handbook of programming languages. Software development for learning and reference . Hanser, Munich 2007, ISBN 978-3-446-40558-5 .
- Kenneth C. Louden: Programming Languages: Fundamentals, Concepts, Design . Boarding school Thomson Publ., Bonn / Albany et al. 1994, ISBN 3-929821-03-6 .
- John C. Reynolds: Theories of Programming Languages . Cambridge Univ. Press, Cambridge 1998, ISBN 0-521-59414-6 .
- Robert Harper: Practical Foundations for Programming Languages . Cambridge Univ. Press, Cambridge 2016, ISBN 978-1-107-15030-0 .
- Peter van Roy, Seif Haridi: Concepts, Techniques, and Models of Computer Programming . MIT Press, Cambridge 2004, ISBN 0-262-22069-5 .
- Michael L. Scott: Programming language pragmatics . 2nd Edition. Elsevier, Morgan Kaufmann, Amsterdam 2006, ISBN 0-12-633951-1 .
Web links
- 99 Bottles of Beer : A program in hundreds of programming languages and dialects (English)
Individual evidence
- ↑ Programming language - Duden , 2019; there literally with "system of words and symbols that are used to formulate programs (4) for electronic data processing"; see also Duden Informatik , ISBN 3-411-05232-5
- ↑ ... see also platform independence (especially in terms of manufacturer independence with regard to arithmetic units ) and abstraction (IT) ...
- ↑ PYPL
- ↑ RedMonk
- ↑ Around 1965 one counted 1700, cf. ISWIM .
- ^ Peter A. Henning, Holger Vogelsang: Paperback programming languages . Specialized book publisher in Carl Hanser Verlag, Leipzig 2007, ISBN 978-3-446-40744-2 .
- ↑ See voice-based system - e.g. B. Singularity based on the Sing # programming language , JX for Java , Coyotos with the BitC language .
- ↑ List of Hello World programs according to programming languages