Programming Language Principles and Paradigms Release 0.3-Alpha

Total Page:16

File Type:pdf, Size:1020Kb

Programming Language Principles and Paradigms Release 0.3-Alpha Programming Language Principles and Paradigms Release 0.3-alpha Amir Kamil Feb 22, 2021 CONTENTS I Foundations1 1 Introduction 3 2 Basic Python 5 2.1 Variables.................................................5 2.2 Basic Data Structures..........................................6 2.3 Compound Statements..........................................8 2.4 Function Definitions...........................................8 2.5 Class Definitions.............................................9 2.6 Modules................................................. 10 2.7 Executing a Module........................................... 10 3 Basic Elements 12 3.1 Levels of Description........................................... 12 3.2 Entities, Objects, and Variables..................................... 14 3.3 L-Values and R-Values.......................................... 14 3.4 Expressions................................................ 15 3.5 Statements................................................ 16 4 Names and Environments 17 4.1 Blocks.................................................. 18 4.2 Name Lookup.............................................. 19 4.3 Nested Inline Blocks........................................... 20 4.4 Scope in Functions............................................ 21 4.5 Static Scope............................................... 22 4.6 Dynamic Scope.............................................. 24 4.7 Point of Declaration or Definition.................................... 25 4.8 Implementation Strategies........................................ 26 5 Control Flow 28 5.1 Expression Sequencing.......................................... 28 5.2 Statement Sequences........................................... 29 5.3 Unstructured Transfer of Control.................................... 30 5.4 Structured Control............................................ 31 5.5 Exceptions................................................ 34 6 Memory Management 36 6.1 Storage Duration Classes......................................... 36 6.2 Value and Reference Semantics..................................... 38 6.3 RAII and Scope-Based Resource Management............................. 41 6.4 Garbage Collection............................................ 43 i 7 Grammars 47 7.1 Regular Expressions........................................... 47 7.2 Context-Free Grammars......................................... 49 7.3 Grammars in Programming Languages................................. 51 II Functional Programming 56 8 Functions 58 8.1 Keyword Arguments........................................... 58 8.2 Default Arguments............................................ 59 8.3 Variadic Functions............................................ 60 8.4 Parameter Passing............................................ 61 8.5 Evaluation of Function Calls....................................... 64 9 Introduction to Scheme 65 9.1 Expressions................................................ 65 9.2 Definitions................................................ 66 9.3 Compound Values............................................ 67 9.4 Symbolic Data.............................................. 69 10 Recursion 71 10.1 Activation Records............................................ 71 10.2 Tail Recursion.............................................. 73 11 Higher-Order Functions 75 11.1 Function Objects............................................. 75 11.2 Functions as Parameters......................................... 77 11.3 Nested Functions............................................. 78 12 Lambda Functions 83 12.1 Scheme.................................................. 83 12.2 Python.................................................. 84 12.3 Java.................................................... 85 12.4 C++.................................................... 85 12.5 Common Patterns............................................ 87 13 Continuations 92 13.1 Restricted Continuations......................................... 92 13.2 First-Class Continuations........................................ 96 III Theory 104 14 Lambda Calculus 106 14.1 Non-Terminating Computation..................................... 109 14.2 Normal-Order Evaluation........................................ 109 14.3 Encoding Data.............................................. 110 14.4 Recursion................................................. 115 14.5 Equivalent Models............................................ 116 15 Operational Semantics 118 15.1 Language................................................. 119 15.2 States and Transitions.......................................... 119 15.3 Expressions................................................ 120 ii 15.4 Statements................................................ 122 15.5 Examples................................................. 124 15.6 Operational Semantics for Lambda Calculus.............................. 124 16 Formal Type Systems 127 16.1 Variables................................................. 128 16.2 Functions................................................. 130 16.3 Subtyping................................................. 131 16.4 Full Typing Rules............................................ 134 IV Data Abstraction 136 17 Functional Data Abstraction 138 17.1 Pairs and Lists.............................................. 138 17.2 Message Passing............................................. 140 17.3 Lists................................................... 140 17.4 Dictionaries................................................ 142 17.5 Dispatch Dictionaries.......................................... 143 18 Object-Oriented Programming 145 18.1 Members................................................. 145 18.2 Access Control.............................................. 146 18.3 Kinds of Methods............................................ 147 18.4 Nested and Local Classes........................................ 149 18.5 Implementation Strategies........................................ 150 19 Inheritance and Polymorphism 153 19.1 Types of Inheritance........................................... 153 19.2 Class Hierarchies............................................. 155 19.3 Method Overriding............................................ 156 19.4 Implementing Dynamic Binding..................................... 160 19.5 Multiple Inheritance........................................... 162 20 Static Analysis 168 20.1 Types................................................... 168 20.2 Control-Flow Analysis.......................................... 171 21 Dynamic Typing 174 22 Generics 176 22.1 Implicit Parametric Polymorphism.................................... 176 22.2 Explicit Parametric Polymorphism.................................... 176 22.3 Duck Typing............................................... 183 23 Modules and Namespaces 185 23.1 Translation Units............................................. 185 23.2 Modules, Packages, and Namespaces.................................. 186 23.3 Linkage.................................................. 189 23.4 Information Hiding............................................ 189 23.5 Initialization............................................... 191 V Declarative Programming 193 24 Logic Programming 195 iii 24.1 Prolog.................................................. 196 24.2 Unification and Search.......................................... 200 24.3 The Cut Operator............................................. 209 24.4 Negation................................................. 210 24.5 Examples................................................. 211 25 Constraints and Dependencies 215 25.1 Constraint Logic Programming..................................... 215 25.2 Make................................................... 219 VI Metaprogramming 222 26 Macros and Code Generation 224 26.1 Scheme Macros............................................. 227 26.2 CPP Macros............................................... 228 26.3 Code Generation............................................. 232 27 Template Metaprogramming 234 27.1 Pairs................................................... 235 27.2 Numerical Computations......................................... 239 27.3 Templates and Function Overloading.................................. 242 27.4 SFINAE................................................. 243 27.5 Ensuring a Substitution Failure..................................... 244 27.6 Variadic Templates............................................ 246 28 Example: Multidimensional Arrays 250 28.1 Points................................................... 250 28.2 Domains................................................. 252 28.3 Arrays.................................................. 254 28.4 Stencil.................................................. 256 28.5 Nested Iteration............................................. 257 VII Concurrent Programming 260 29 Parallel Computing 262 29.1 Parallelism in Python........................................... 263 29.2 The Problem with Shared State..................................... 264 29.3 When No Synchronization is Necessary................................. 265 29.4 Synchronized Data Structures...................................... 266 29.5 Locks................................................... 267 29.6 Barriers.................................................. 268 29.7 Message Passing............................................. 268 29.8 Application Examples.......................................... 269 29.9 Synchronization Pitfalls........................................
Recommended publications
  • ISO/IEC JTC 1/SC 22/WG4 N 0163 Information Technology
    ISO/IEC JTC 1/SC 22/WG4 N 0163 Date: 2002-05-21 Reference number of document: WDTR 19755 Version 1.1 Committee identification: ISO/IEC JTC 1/SC 22 /WG 4 Secretariat: ANSI Information Technology — Programming languages, their environments and system software interfaces — Object finalization for programming language COBOL Warning This document is an ISO/IEC proposed draft Technical Report. It is not an ISO/IEC International Technical Report. It is distributed for review and comment. It is subject to change without notice and shall not be referred to as an International Technical Report or International Standard. Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation. Document type: Technical report Document subtype: n/a Document stage: (20) Preparation Document language: E ISO/WDTR 19755 Copyright notice This ISO/IEC document is a working draft and is copyright-protected by ISO/IEC. Requests for permission to reproduce this document for the purpose of selling it should be addressed as shown below or to ISO’s member body in the country of the requester: Copyright manager ISO Central Secretariat 1 rue de Varembé 1211 Geneva 20 Switzerland tel: +41 22 749 0111 fax: +41 22 734 0179 email: [email protected] Reproduction for sales purposes may be subject to royalty payments or a licensing agreement. Violators may be prosecuted. ii © ISO/IEC 2002 – All rights reserved ISO/IEC WDTR 19755 Acknowledgement notice COBOL originated in 1959 as a common business oriented language developed by the Conference on Data Systems Languages (CODASYL).
    [Show full text]
  • Stable/Build) • --Port PORT - Set the PORT Number (Default: 8000)
    Pyodide Release 0.18.1 unknown Sep 16, 2021 CONTENTS 1 Using Pyodide 3 1.1 Getting started..............................................3 1.2 Downloading and deploying Pyodide..................................6 1.3 Using Pyodide..............................................7 1.4 Loading packages............................................ 12 1.5 Type translations............................................. 14 1.6 Pyodide Python compatibility...................................... 25 1.7 API Reference.............................................. 26 1.8 Frequently Asked Questions....................................... 50 2 Development 55 2.1 Building from sources.......................................... 55 2.2 Creating a Pyodide package....................................... 57 2.3 How to Contribute............................................ 64 2.4 Testing and benchmarking........................................ 74 2.5 Interactive Debugging.......................................... 76 3 Project 79 3.1 About Pyodide.............................................. 79 3.2 Roadmap................................................. 80 3.3 Code of Conduct............................................. 82 3.4 Governance and Decision-making.................................... 83 3.5 Change Log............................................... 85 3.6 Related Projects............................................. 95 4 Indices and tables 97 Python Module Index 99 Index 101 i ii Pyodide, Release 0.18.1 Python with the scientific stack, compiled to WebAssembly.
    [Show full text]
  • Ece351 Lab Manual
    DEREK RAYSIDE & ECE351 STAFF ECE351 LAB MANUAL UNIVERSITYOFWATERLOO 2 derek rayside & ece351 staff Copyright © 2014 Derek Rayside & ECE351 Staff Compiled March 6, 2014 acknowledgements: • Prof Paul Ward suggested that we look into something with vhdl to have synergy with ece327. • Prof Mark Aagaard, as the ece327 instructor, consulted throughout the development of this material. • Prof Patrick Lam generously shared his material from the last offering of ece251. • Zhengfang (Alex) Duanmu & Lingyun (Luke) Li [1b Elec] wrote solutions to most labs in txl. • Jiantong (David) Gao & Rui (Ray) Kong [3b Comp] wrote solutions to the vhdl labs in antlr. • Aman Muthrej and Atulan Zaman [3a Comp] wrote solutions to the vhdl labs in Parboiled. • TA’s Jon Eyolfson, Vajih Montaghami, Alireza Mortezaei, Wenzhu Man, and Mohammed Hassan. • TA Wallace Wu developed the vhdl labs. • High school students Brian Engio and Tianyu Guo drew a number of diagrams for this manual, wrote Javadoc comments for the code, and provided helpful comments on the manual. Licensed under Creative Commons Attribution-ShareAlike (CC BY-SA) version 2.5 or greater. http://creativecommons.org/licenses/by-sa/2.5/ca/ http://creativecommons.org/licenses/by-sa/3.0/ Contents 0 Overview 9 Compiler Concepts: call stack, heap 0.1 How the Labs Fit Together . 9 Programming Concepts: version control, push, pull, merge, SSH keys, IDE, 0.2 Learning Progressions . 11 debugger, objects, pointers 0.3 How this project compares to CS241, the text book, etc. 13 0.4 Student work load . 14 0.5 How this course compares to MIT 6.035 .......... 15 0.6 Where do I learn more? .
    [Show full text]
  • Solid Code Ebook
    PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 2009 by Donis Marshall and John Bruno All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Library of Congress Control Number: 2008940526 Printed and bound in the United States of America. 1 2 3 4 5 6 7 8 9 QWT 4 3 2 1 0 9 Distributed in Canada by H.B. Fenn and Company Ltd. A CIP catalogue record for this book is available from the British Library. Microsoft Press books are available through booksellers and distributors worldwide. For further infor mation about international editions, contact your local Microsoft Corporation office or contact Microsoft Press International directly at fax (425) 936-7329. Visit our Web site at www.microsoft.com/mspress. Send comments to [email protected]. Microsoft, Microsoft Press, Active Desktop, Active Directory, Internet Explorer, SQL Server, Win32, Windows, Windows NT, Windows PowerShell, Windows Server, and Windows Vista are either registered trademarks or trademarks of the Microsoft group of companies. Other product and company names mentioned herein may be the trademarks of their respective owners. The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. This book expresses the author’s views and opinions. The information contained in this book is provided without any express, statutory, or implied warranties.
    [Show full text]
  • Visual Smalltalk Enterprise ™ ™
    Visual Smalltalk Enterprise ™ ™ Language Reference P46-0201-00 Copyright © 1999–2000 Cincom Systems, Inc. All rights reserved. Copyright © 1999–2000 Seagull Systems, Inc. All rights reserved. This product contains copyrighted third-party software. Part Number: P46-0201-00 Software Release 3.2 This document is subject to change without notice. RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013. Trademark acknowledgments: CINCOM, CINCOM SYSTEMS, and the Cincom logo are registered trademarks of Cincom Systems, Inc. Visual Smalltalk is a trademark of Cincom Systems, Inc., its subsidiaries, or successors and are registered in the United States and other countries. Microsoft Windows is a registered trademark of Microsoft, Inc. Win32 is a trademark of Microsoft, Inc. OS/2 is a registered trademark of IBM Corporation. Other product names mentioned herein are used for identification purposes only, and may be trademarks of their respective companies. The following copyright notices apply to software that accompanies this documentation: Visual Smalltalk is furnished under a license and may not be used, copied, disclosed, and/or distributed except in accordance with the terms of said license. No class names, hierarchies, or protocols may be copied for implementation in other systems. This manual set and online system documentation copyright © 1999–2000 by Cincom Systems, Inc. All rights reserved. No part of it may be copied, photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form without prior written consent from Cincom.
    [Show full text]
  • Scala Tutorial
    Scala Tutorial SCALA TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Scala Tutorial Scala is a modern multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way. Scala has been created by Martin Odersky and he released the first version in 2003. Scala smoothly integrates features of object-oriented and functional languages. This tutorial gives a great understanding on Scala. Audience This tutorial has been prepared for the beginners to help them understand programming Language Scala in simple and easy steps. After completing this tutorial, you will find yourself at a moderate level of expertise in using Scala from where you can take yourself to next levels. Prerequisites Scala Programming is based on Java, so if you are aware of Java syntax, then it's pretty easy to learn Scala. Further if you do not have expertise in Java but you know any other programming language like C, C++ or Python, then it will also help in grasping Scala concepts very quickly. Copyright & Disclaimer Notice All the content and graphics on this tutorial are the property of tutorialspoint.com. Any content from tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws. This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the accuracy of the site or its contents including this tutorial. If you discover that the tutorialspoint.com site or this tutorial content contains some errors, please contact us at [email protected] TUTORIALS POINT Simply Easy Learning Table of Content Scala Tutorial ..........................................................................
    [Show full text]
  • Php Foreach Array Example
    Php Foreach Array Example Positivism Sonnie always besought his dimeters if Esme is fruticose or touch-types incompletely. Sometimes anything.plenipotentiary Zane Gordieemits unobtrusively alchemise her while foreman untrained slower, Harlan but bubbliest presages Rodge obsoletely strides or pippingriotously masterfully. or recapitalizes You can have explored deep are using array_map prevents you forgot, and will keep multiple. How we have an associative array is a different values are times has a numeric array and arrays can be obtained by working along. This url into two variables are such type. PHP 4 introduced foreach construct it works only on arrays. Let's understand this with the help bear the porter example. The running one uses it. PHP foreach Manual. Sample PHP Code PHP For Loops Foreach While ago Do. Arrayvalue is your temporary variable that holds the current total item values block of code is the its of code that operates on already array values Example 1. Usually depending on my favourite site for passing it on how if statement. PHP foreach loops FreeKB. Start from any one statement is that, instead of items in an example of each elements with examples to get an array. PHP foreach within foreach repeat data flow not escaping loops. Of iteration helps you can access or public route on here? PHP foreach Loop GeeksforGeeks. Foreach Semantic portal learn smart. Nested for loops One for brother can be no inside another for purpose and force can generate different scripts using nested loops Here is an intelligence for. Here there is used in a block on array index or break statement or associative array by using a multidimensional array an.
    [Show full text]
  • Gnu Smalltalk Library Reference Version 3.2.5 24 November 2017
    gnu Smalltalk Library Reference Version 3.2.5 24 November 2017 by Paolo Bonzini Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled \GNU Free Documentation License". 1 3 1 Base classes 1.1 Tree Classes documented in this manual are boldfaced. Autoload Object Behavior ClassDescription Class Metaclass BlockClosure Boolean False True CObject CAggregate CArray CPtr CString CCallable CCallbackDescriptor CFunctionDescriptor CCompound CStruct CUnion CScalar CChar CDouble CFloat CInt CLong CLongDouble CLongLong CShort CSmalltalk CUChar CByte CBoolean CUInt CULong CULongLong CUShort ContextPart 4 GNU Smalltalk Library Reference BlockContext MethodContext Continuation CType CPtrCType CArrayCType CScalarCType CStringCType Delay Directory DLD DumperProxy AlternativeObjectProxy NullProxy VersionableObjectProxy PluggableProxy SingletonProxy DynamicVariable Exception Error ArithmeticError ZeroDivide MessageNotUnderstood SystemExceptions.InvalidValue SystemExceptions.EmptyCollection SystemExceptions.InvalidArgument SystemExceptions.AlreadyDefined SystemExceptions.ArgumentOutOfRange SystemExceptions.IndexOutOfRange SystemExceptions.InvalidSize SystemExceptions.NotFound SystemExceptions.PackageNotAvailable SystemExceptions.InvalidProcessState SystemExceptions.InvalidState
    [Show full text]
  • Comparative Studies of Programming Languages; Course Lecture Notes
    Comparative Studies of Programming Languages, COMP6411 Lecture Notes, Revision 1.9 Joey Paquet Serguei A. Mokhov (Eds.) August 5, 2010 arXiv:1007.2123v6 [cs.PL] 4 Aug 2010 2 Preface Lecture notes for the Comparative Studies of Programming Languages course, COMP6411, taught at the Department of Computer Science and Software Engineering, Faculty of Engineering and Computer Science, Concordia University, Montreal, QC, Canada. These notes include a compiled book of primarily related articles from the Wikipedia, the Free Encyclopedia [24], as well as Comparative Programming Languages book [7] and other resources, including our own. The original notes were compiled by Dr. Paquet [14] 3 4 Contents 1 Brief History and Genealogy of Programming Languages 7 1.1 Introduction . 7 1.1.1 Subreferences . 7 1.2 History . 7 1.2.1 Pre-computer era . 7 1.2.2 Subreferences . 8 1.2.3 Early computer era . 8 1.2.4 Subreferences . 8 1.2.5 Modern/Structured programming languages . 9 1.3 References . 19 2 Programming Paradigms 21 2.1 Introduction . 21 2.2 History . 21 2.2.1 Low-level: binary, assembly . 21 2.2.2 Procedural programming . 22 2.2.3 Object-oriented programming . 23 2.2.4 Declarative programming . 27 3 Program Evaluation 33 3.1 Program analysis and translation phases . 33 3.1.1 Front end . 33 3.1.2 Back end . 34 3.2 Compilation vs. interpretation . 34 3.2.1 Compilation . 34 3.2.2 Interpretation . 36 3.2.3 Subreferences . 37 3.3 Type System . 38 3.3.1 Type checking . 38 3.4 Memory management .
    [Show full text]
  • Deferred Cancellation
    Deferred Cancellation A behavioral pattern Philipp Bachmann Institute for Medical Informatics and Biostatistics Clarastrasse 12 CH–4058 Basel, BS Switzerland [email protected] ABSTRACT General Terms People who design their own pool of worker threads [33, Design pp 290–298] or processes have to consider how to shut down the workers again or how to dynamically adapt the num- Keywords ber of workers to varying load. Especially with regard to application termination you may have the choice between an Patterns, Destructor, Actor, Reliability, Portability immediate destruction of the pool and a more graceful shut- down. The pattern proposed helps to portably implement Sir, my need is sore. such termination and load adaptation mechanisms that as- Spirits that I’ve cited My commands ignore. sume you voted for the second choice. The main area of application are the internals of active objects [40] and Johann Wolfgang von Goethe: The Sorcerer’s similar designs that delegate work to a pool of threads or Apprentice [23] processes to execute service requests asynchronously from their actual invocation. For the pattern proposed we identified usage examples in 1. INTENT popular existing applications or libraries. Safely shut down pools of worker threads [33, pp 290– Both a real world example and sample code accompany 298] or processes without resource leakages and premature the pattern presentation. This sample code is in C++. rollback of transactions. The design proposed aims at The presentation of the pattern follows the style portability. well known from [11] and [44]. This pattern is based upon other patterns. Typographic conventions for references to other patterns are similar to [3].
    [Show full text]
  • Aeroscript Programming Language Reference
    AeroScript Programming Language Reference Table of Contents Table of Contents 2 Structure of a Program 5 Comments 6 Preprocessor 7 Text Replacement Macro (#define/#undef) 7 Source File Inclusion (#include) 8 Conditional Inclusion (#if/#ifdef/#ifndef) 8 Data Types and Variables 11 Fundamental Data Types 11 Fundamental Numeric Data Types 11 Fundamental String Data Type 11 Fundamental Axis Data Type 11 Fundamental Handle Data Type 12 Aggregate Data Types 12 Array Data Types 12 Structure Data Types 13 Enumerated Data Types 14 Variables 15 Variable Declaration 15 Variable Names 15 Numeric, Axis, and Handle Variable Declaration Syntax 15 String Variable Declaration Syntax 15 Syntax for Declaring Multiple Variables on the Same Line 16 Array Variable Declaration Syntax 16 Structure Variable Definition and Declaration Syntax 16 Definition Syntax 16 Declaration Syntax 17 Member Access Syntax 17 Enumeration Variable Definition and Declaration Syntax 18 Definition 18 Declaration Syntax 19 Enumerator Access Syntax 19 Variable Initialization Syntax 20 Basic Variable Initialization Syntax 20 Array Variable Initialization Syntax 21 Structure Variable Initialization Syntax 22 Enumeration Variable Initialization Syntax 22 Variable Scope 23 Controller Global Variables 23 User-Defined Variables 23 User-Defined Variable Accessibility 23 User-Defined Local Variable Declaration Location 25 Variable Data Type Conversions 26 Properties 27 Property Declaration 27 Property Names 27 Property Declaration 28 Property Usage 28 Expressions 29 Literals 29 Numeric Literals
    [Show full text]
  • CS 0449: Introduction to Systems Software
    CS 0449: Introduction to Systems Software Jonathan Misurda Computer Science Department University of Pittsburgh [email protected] http://www.cs.pitt.edu/∼jmisurda Version 3, revision 1 Last modified: July 27, 2017 at 1:33 P.M. Copyright © 2017 by Jonathan Misurda This text is meant to accompany the course CS 0449 at the University of Pittsburgh. Any other use, commercial or otherwise, is prohibited without permission of the author. All rights reserved. Java is a registered trademark of Oracle Corporation. This reference is dedicated to the students of CS 0449, Fall 2007 (2081). Their patience in dealing with a changing course and feedback on the first version of this text was greatly appreciated. Contents Contents i List of Figures v List of Code Listings vii Preface ix 1 Pointers 1 1.1 Basic Pointers . 2 1.1.1 Fundamental Operations . 2 1.2 Passing Pointers to Functions . 4 1.3 Pointers, Arrays, and Strings . 5 1.3.1 Pointer Arithmetic . 6 1.4 Terms and Definitions . 7 2 Variables: Scope & Lifetime 8 2.1 Scope and Lifetime in C . 9 2.1.1 Global Variables . 11 2.1.2 Automatic Variables . 12 2.1.3 Register variables . 13 2.1.4 Static Variables . 13 2.1.5 Volatile Variables . 16 2.2 Summary Table . 17 2.3 Terms and Definitions . 17 ii Contents 3 Compiling & Linking: From Code to Executable 19 3.1 The Stages of Compilation . 19 3.1.1 The Preprocessor . 20 3.1.2 The Compiler . 21 3.1.3 The Linker . 22 3.2 Executable File Formats .
    [Show full text]