Concepts and Semantics of Programming Languages 1. Therese Hardin
Чтение книги онлайн.

Читать онлайн книгу Concepts and Semantics of Programming Languages 1 - Therese Hardin страница 7

Название: Concepts and Semantics of Programming Languages 1

Автор: Therese Hardin

Издательство: John Wiley & Sons Limited

Жанр: Программы

Серия:

isbn: 9781119824091

isbn:

СКАЧАТЬ considerations, determined by the material characteristics of computers and/or “smart” devices, will also be addressed. The same approach will be taken in both volumes, using both mathematical formulas and memory state diagrams. With this book, we hope to help readers understand the meaning of the constructs described in the reference manuals of programming languages and to establish solid foundations for reasoning and assessing the correctness of their own programs through critical review. In short, our aim is to facilitate the development of safe and reliable programs.

      Thus, Volume 1 is intended to give a broad overview of the functional and imperative features of programming, from notions that can be modeled mathematically to notions that are linked to the hardware configuration of computers themselves. Volume 2 focuses on modular and object programming, building on the foundations laid down in Volume 1 since modules, classes and objects are, in essence, the means of organizing functional or imperative constructs. Volume 2 first analyzes the needs of developers in terms of tools for software architecture. Based on this study, an original semantic model, called a kit, is drawn up, jointly presenting all the features of the modules and objects that can meet these needs. The semantics of these kits are defined in a rather informal way, as research in this field has not yet led to a mathematical model of this set of features, while remaining relatively simple. From this model, we consider a set of emerging questions, the objective of which is to guide the acquisition of a language. This approach is then exemplified by the study of the module systems of Ada, OCaml and C. Finally, the same approach will be used to deduce a semantic model of class and object features, which will serve to present classes in Java, C++, OCaml and Python from a unified perspective.

      This work is aimed at a relatively wide audience, from experienced developers – who will find valuable additional information on language semantics – to beginners who have only written short programs. For beginners, we recommend working on the semantic concepts described in Volume 1 using the implementations in OCaml or Python to ease assimilation. All readers may benefit from studying the reference manual of a programming language, while comparing the presentations of constructs given in the manual with those given here, guided by the questions mentioned in Volume 2.

      Note that we do not discuss the algorithmic aspect of data processing here. However, choosing the algorithm and the data representation that fit the requirements of the specification is an essential step in program development. Many excellent works have been published on this subject, and we encourage readers to explore the subject further. We also recommend using the standard libraries provided by the chosen programming language. These libraries include tried and tested implementations for many different algorithms, which may generally be assumed to be correct.

      1

      From Hardware to Software

      This first chapter provides a brief overview of the components found in all computers, from mainframes to the processing chips in tablets, smartphones and smart objects via desktop or laptop computers. Building on this hardware-centric presentation, we shall then give a more abstract description of the actions carried out by computers, leading to a uniform definition of the terms “program” and “execution”, above and beyond the various characteristics of so-called electronic devices.

      Computer science is the science of rational processing of information by computers. Computers have the capacity to carry out a variety of processes, depending on the instructions given to them. Each item of information is an element of knowledge that may be transmitted using a signal and encoded using a sequence of symbols in conjunction with a set of rules used to decode them, i.e. to reconstruct the signal from the sequence of symbols. Computers use binary encoding, involving two symbols; these may be referred to as “true”/”false”, “0”/”1” or “high”/”low”; these terms are interchangeable, and all represent the two stable states of the electrical potential of digital electronic circuits.

      1.1.1. Information processing

      Schematically, a computer is made up of three families of components as follows:

       – memories: store data (information) and executable code (the so-called von Neumann architecture);

       – one or more microprocessors, known as CPUs (central processing units), which process information by applying elementary operations;

       – peripherals: these enable information to be exchanged between the CPU/memory couple and the outside.

      Information processing by a computer – in other terms, the execution of a program – can be summarized as a sequence of three steps: fetching data, computing the results and returning them. Each elementary processing operation corresponds to a configuration of the logical circuits of the CPU, known as a logic function. If the result of this function is solely dependent on input, and if no notion of “time” is involved in the computations, then the function is said to be combinatorial; otherwise, it is said to be sequential.

      The СКАЧАТЬ