
Concepts and Semantics of Programming Languages 1
A Semantical Approach with OCaml and Python
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Concepts and Semantics of Programming Languages 1
A Semantical Approach with OCaml and Python
About this book
This book – the first of two volumes – explores the syntactical constructs of the most common programming languages, and sheds a mathematical light on their semantics, while also providing an accurate presentation of the material aspects that interfere with coding.
Concepts and Semantics of Programming Languages 1 is dedicated to functional and imperative features. Included is the formal study of the semantics of typing and execution; their acquisition is facilitated by implementation into OCaml and Python, as well as by worked examples. Data representation is considered in detail: endianness, pointers, memory management, union types and pattern-matching, etc., with examples in OCaml, C and C++. The second volume introduces a specific model for studying modular and object features and uses this model to present Ada and OCaml modules, and subsequently Java, C++, OCaml and Python classes and objects.
This book is intended not only for computer science students and teachers but also seasoned programmers, who will find a guide to reading reference manuals and the foundations of program verification.
Frequently asked questions
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Information
1
From Hardware to Software
1.1. Computers: a low-level view
1.1.1. Information processing
- – 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.

1.1.2. Memories
- – RAM (Random Access Memory): RAM memory is both readable and writeable. RAM components are generally fast, but also volatile: if electric power falls down, their content is lost;
- – ROM (Read Only Memory): information stored in a ROM is written at the time of manufacturing, and it is read-only. ROM is slower than RAM, but is non-volatile, like, for example, a burned DVD;
- – EPROM (Erasable Programmable Read Only Memory): this memory is non-volatile, but can be written using a specific device, through exposure to ultra- violet light, or by modifying the power voltage, etc. It is slower than RAM, for both reading and writing. EPROM may be considered equivalent to a rewritable DVD.
- – mass storage is measured in terabytes and is made either of mechanical disks (with an access time of ~ 10 ms) or – increasingly – of solid-state drive (SSD) blocks. These blocks use an EEPROM variant (electrically erasable) with an access time of ~ 0.1 – 0.3 ms, known as flash memory. Mass storage is non-volatile and is principally used for the file system;
- – RAM, which is external to the microprocessor. Recent home computers and smartphones generally possess large RAM capacities (measured in gigabytes). Embedded systems or consumer development electronic boards may have a much lower RAM capacity. The access time is around 40–50 ηs;
- – the cache is generally included in the CPU of modern machines. This is a small RAM memory of a few kilobytes (or megabytes), with an access time of around 5 – 10 ηs. There are often multiple levels of cache, and access time decreases with size. The cache is used to save frequently used and/or consecutive data and/or instructions, reducing the need to access slower RAM by retaining information locally. Cache management is complex: it is important to ensure consistency between the data in the main memory and the cache, between different CPUs or different cores (full, independent processing units within the same CPU) and to decide which data to discard to free up space, etc.;
- – registers are the fastest memory units and are located in the center of the microprocessor itself. The microprocessor contains a limited number (a few dozen) of these storage zones, used directly by CPU instructions. Access time is around one processor cycle, i.e. around 1 ns.
1.1.3. CPUs
- – data transfer instructions (copy between registers or between memory and registers);
- – arithmetic instructions (addition of two integer values contained in two registers, multiplication by a constant, etc.);
- – logical instructions (bit-wise and/or/not, shift, rotate, etc.);
- – branching operations (conditional, non-conditional, to subroutines, etc.);
- – other instructions (halt the processor, reset, interrupt requests,
test-and-set, compare-and-swap,etc.).
Table of contents
- Cover
- Table of Contents
- Title Page
- Copyright
- Foreword
- Preface
- 1 From Hardware to Software
- 2 Introduction to Semantics of Programming Languages
- 3 Semantics of Functional Features
- 4 Semantics of Imperative Features
- 5 Types
- 6 Data Types
- 7 Pointers and Memory Management
- 8 Exceptions
- Conclusion
- Appendix: Solutions to the Exercises
- List of Notations
- Index of Programs
- References
- Index
- End User License Agreement