Introduction To Programming Languages Programming in C C Scheme Prolog C and SOA 5th Edition Yinong Chen Instant Download
Introduction To Programming Languages Programming in C C Scheme Prolog C and SOA 5th Edition Yinong Chen Instant Download
https://ebookfinal.com/download/introduction-to-programming-languages-
programming-in-c-c-scheme-prolog-c-and-soa-5th-edition-yinong-chen/
https://ebookfinal.com/download/programming-languages-principles-and-
practices-3rd-edition-kenneth-c-louden/
https://ebookfinal.com/download/medicine-in-rural-china-c-c-chen/
https://ebookfinal.com/download/c-programming-in-linux-2nd-edition-
david-haskins/
https://ebookfinal.com/download/c-programming-program-design-
including-data-structures-5th-edition-d-s-malik/
A Complete Guide to Programming in C 1st Edition Ulla
Kirch-Prinz
https://ebookfinal.com/download/a-complete-guide-to-programming-
in-c-1st-edition-ulla-kirch-prinz/
https://ebookfinal.com/download/mastering-c-database-programming-1st-
edition-jason-price/
https://ebookfinal.com/download/programming-with-ansi-c-2nd-edition-
bhushan-trivedi/
https://ebookfinal.com/download/programming-in-prolog-fifth-edition-w-
f-clocksin/
Introduction to Programming Languages Programming
in C C Scheme Prolog C and SOA 5th Edition Yinong
Chen Digital Instant Download
Author(s): Yinong Chen
ISBN(s): 9781524916992, 1524916994
Edition: 5
File Details: PDF, 27.24 MB
Year: 2016
Language: english
Introduction to Programming Languages
Fifth Edition
Yinong Chen
Arizona State University
Kendall Hunt
publishing company
Cover image courtesy of© Shutter stock, Inc. Used under license.
Kendall Hunt
publis�ing company
www .kendallhunt.com
Send all inquiries to:
4050 West mark Drive
Dubuque, IA 52004-1840
Copyright© 2003, 2006, 2012, 2015 by Yinong Chen and Wei-Tek Tsai
2017 by Kendall Hunt Publishing Company
ISBN 978-1-5249-1699-2
Preface .............................................................................................................................................. x1
Chapter 1 Basic Principles of Programming Languages.................................................................... 1
1.1 Introduction............................................................................................................................ 2
1.1.1 Programming concepts and paradigms 2
1.1.2 Program performance and features of programming languages 3
1.1.3 Development of programming languages 4
1.2 Structures of programming languages ................................................................................... 8
1.2.1 Lexical structure 8
1.2.2 Syntactic structure 9
1.2.3 Contextual structure 9
1.2.4 Semantic structure 9
1.2.5 BNF notation 9
1.2.6 Syntax graph 11
1.3 Data types and type checking .............................................................................................. 12
1.3.1 Data types and type equivalence 13
1.3.2 Type checking and type conversion 13
1.3.3 Orthogonality 14
1.4 Program processing and preprocessing ................................................................................ 16
1.4.1 Interpretation and compilation 16
1.4.2 Preprocessing: macro and inlining 18
* 1.5 Program development .......................................................................................................... 23
1.5.1 Program development process 23
1.5.2 Program testing 24
1.5.3 Correctness proof 27
1.6 Summary .............................................................................................................................. 29
1.7 Homework and programming exercises .............................................................................. 31
Chapter 2 The Imperative Programming Languages, C/C++ ......................................................... 39
2.1 Getting started with CIC++.................................................................................................. 40
2.1.1 Write your first CIC++ program 40
2.1.2 Basic input and output functions 41
2.1.3 Formatted input and output functions 42
2.2 Control structures in CIC++ ................................................................................................. 44
2.2.1 Operators and the order of evaluation 44
111
2.2.2 Basic selection structures (if-then-else and the conditional expression) 45
2.2.3 Multiple selection structure (switch) 46
2.2.4 Iteration structures (while, do-while, and for) 49
2.3 Data and basic data types in CIC++ ..................................................................................... 51
2.3.1 Declaration of variables and functions 51
2.3.2 Scope rule 52
2.3.3 Basic data types 53
2.4 Complex types ..................................................................................................................... 56
2.4.1 Array 56
2.4.2 Pointer 58
2.4.3 String 60
2.4.4 Constants 69
2.4.5 Enumeration type 70
2.5 Compound data types........................................................................................................... 73
2.5.1 Structure types and paddings 73
2.5.2 Union 75
2.5.3 Array of structures using static memory allocation 77
2.5.4 Linked list using dynamic memory allocation 80
2.5.5 Doubly linked list 84
2.5.6 Stack 86
2.6 Standard input and output, files, and file operations ........................................................... 89
2.6.1 Basic concepts of files and file operations 89
2.6.2 File operations in C 90
2.6.3 Flush operation in C 95
2.7 Functions and parameter passing ......................................................................................... 97
2.8 Recursive structures and applications ................................................................................ 101
2.8.1 Loop structures versus recursive structures 101
2.8.2 The fantastic-four abstract approach of writing recursive functions 102
2.8.3 Hanoi Towers 103
2.8.4 Insertion sorting 106
2.8.5 Merge sort algorithm 108
2.8.6 Quick sort algorithm 110
2.8.7 Tree operations 110
2.8.8 Gray code generation 114
2.9 Modular design .................................................................................................................. 116
2.10 Case Study: Putting All Together ...................................................................................... 118
iv
2.11 Summary ............................................................................................................................ 125
2.12 Homework, programming exercises, and projects ............................................................. 127
Chapter 3 The Object-Oriented Programming Language, C++ ................................................... 147
3.1 A long program example: a queue and a priority queue written in C++ ........................... 148
3.2 Class definition and composition ....................................................................................... 151
3.2.1 Class definition 151
3.2.2 Scope resolution operator 152
3.2.3 Objects from a class 153
3.2.4 Definition of constructor and destructor 153
3.3 Memory management and garbage collection ................................................................... 154
3.3.1 Static: global variables and static local variables 155
3.3.2 Runtime stack for local variables 156
3.3.3 Heap: dynamic memory allocation 159
3.3.4 Scope and garbage collection 159
3.3.5 Memory leak detection 164
3.4 Inheritance ......................................................................................................................... 171
3.4.1 Class containment and inheritance 171
3.4.2 Inheritance and virtual function 174
3.4.3 Inheritance and hierarchy 177
3.4.4 Inheritance and polymorphism 191
3.4.5 Polymorphism and type checking 193
3.4.6 Polymorphism and late binding 194
3.4.7 Type Casting in C++ 194
3.5 Function and Operator Overloading .................................................................................. 196
3.5.1 Function overloading 196
3.5.2 Operator overloading 197
3.6 File Operations in C++ ...................................................................................................... 203
3.6.1 File objects and operations in C++ 203
3.6.2 Ignore operation in C++ 208
3.7 Exception Handling ........................................................................................................... 209
3.8 Case Study: Putting All Together ...................................................................................... 213
3.8.1 Organization of the program 213
3.8.2 Header files 214
3.8.3 Source fi1es 216
*3.9 Parallel computing and multithreading .............................................................................. 224
3.9. l Basic concepts in parallel computing and multithreading 224
V
3.9.2 Generic features in C++ 224
3.9.3 Case Study: Implementing multithreading in C++ 226
3.10 Summary ............................................................................................................................ 230
3.11 Homework, programming exercises, and projects ............................................................. 231
Chapter 4 The Functional Programming Language, Scheme ....................................................... 241
4.1 From imperative programming to functional programming .............................................. 242
4.2 Prefix notation.................................................................................................................... 244
4.3 Basic Scheme terminology ................................................................................................ 246
4.4 Basic Scheme data types and functions ............................................................................. 249
4.4.1 Number types 249
4.4.2 Boolean 250
4.4.3 Character 251
4.4.4 String 252
4.4.5 Symbol 252
4.4.6 Pair 252
4.4.7 List 254
4.4.8 Application of Quotes 255
4.4.9 Definition of procedure and procedure type 256
4.4.10 Input/output and nonfunctional features 258
*4.5 Lambda-calculus ................................................................................................................ 260
4.5.1 Lambda-expressions 260
4.5.2 A-procedure and parameter scope 261
4.5.3 Reduction rules 261
4.6 Define your Scheme procedures and macros ..................................................................... 262
4.6.1 Unnamed procedures 263
4.6.2 Named procedures 263
4.6.3 Scopes of variables and procedures 263
4.6.4 Let-form and unnamed procedures 265
4.6.5 Macros 266
4.6.6 Compare and contrast imperative and functional programming paradigms 268
4.7 Recursive procedures ......................................................................................................... 270
4.8 Define recursive procedures on data types ........................................................................ 272
4.8.1 Number manipulations 272
4.8.2 Character and string manipulations 276
4.8.3 List manipulations 277
4.9 Higher-order functions....................................................................................................... 279
Vl
4.9.1 Mapping 280
4.9.2 Reduction 283
4.9.3 Filtering 284
4.9.4 Application of filtering in query languages 286
4.10 Summary ............................................................................................................................ 287
4.11 Homework, programming exercises, and projects ............................................................. 289
Chapter 5 The Logic Programming Language, Prolog .................................................................. 299
5.1 Basic concepts of logic programming in Prolog ................................................................ 299
5.1.1 Prolog basics 300
5.1.2 Structures of Prolog facts, rules, and goals 302
5.2 The Prolog execution model .............................................................................................. 303
5.2.1 Unification of a goal 303
5.2.2 Example of searching through a database 305
5.3 Arithmetic operations and database queries ...................................................................... 306
5.3.1 Arithmetic operations and built-in functions 306
5.3.2 Combining database queries with arithmetic operations 308
5.4 Prolog functions and recursive rules .................................................................................. 310
5.4.l Parameter passing in Prolog 310
5.4.2 Factorial example 311
5.4.3 Fibonacci numbers example 311
5.4.4 Hanoi Towers 312
5.4.5 Graph model and processing 313
5.4.6 Map representation and coloring 314
5.5 List and list manipulation .................................................................................................. 316
5.5.1 Definition of pairs and lists 316
5.5.2 Pair simplification rules 317
5.5.3 List membership and operations 318
5.5.4 Knapsack problem 321
5.5.5 Quick sort 322
5.6 Flow control structures ...................................................................................................... 323
5.6.l Cut 324
5.6.2 Fail 327
5.6.3 Repeat 328
*5.7 Prolog application in semantic Web .................................................................................. 330
5.8 Summary ............................................................................................................................ 331
5.9 Homework, programming exercises, and projects ............................................................. 333
vii
Chapter 6 Fundamentals of the Service-Oriented Computing Paradigm .................................... 341
6.1 Introduction to C# .............................................................................................................. 341
6.1.1 Getting started with C# and Visual Studio 341
6.1.2 Comparison between C++ and C# 343
6.1.3 N amespaces and the using directives 343
6.1.4 The queue example in C# 345
6.1.5 Class and object in C# 346
6.1.6 Parameters: passing by reference with re f&out 349
6.1.7 Base classes and constructors 350
6.1.8 Constructor, destructor, and garbage collection 350
6.1.9 Pointers in C# 351
6.1.10 C# unified type system 352
6.1.11 Further topics in C# 353
6.2 Service-oriented computing paradigm ............................................................................... 353
6.2.l Basic concepts and terminologies 353
6.2.2 Web services development 355
6.2.3 Service-oriented system engineering 356
6.2.4 Web services and enabling technologies 357
6.3 *Service providers: programming web services in C# ...................................................... 358
6.3.l Creating a web service project 359
6.3.2 Writing the service class 360
6.3.3 Launch and access your web services 361
6.3.4 Automatically generating a WSDL file 363
6.4 Publishing and searching web services using UDDI ......................................................... 365
6.4.1 UDDI file 365
6.4.2 ebXML 367
6.4.3 Ad hoc registry lists 368
6.5 Building applications using ASP.Net ................................................................................ 368
6.5.1 Creating your own web browser 368
6.5.2 Creating a Windows application project in ASP.Net 369
6.5.3 Developing a website application to consume web services 374
6.6 Silverlight and Phone Applications Development ............................................................. 377
6.6.1 Silverlight Applications 377
6.6.2 Developing Windows Phone Apps Using Silverlight 380
6.7 Cloud computing and big data processing ......................................................................... 389
6.7.1 Cloud computing 389
6.7.2 Big data 392
Vlll
6.8 Summary ............................................................................................................................ 394
6.9 Homework, programming exercises, and projects ............................................................. 395
Appendix A Basic Computer Architectures and Assembly Language Programming .................... 401
A. l Basic computer components and computer architectures .................................................. 401
A.2 Computer architectures and assembly programming ......................................................... 402
A.3 Subroutines and local variables on stack ........................................................................... 407
Appendix B Programming Environments Supporting C, C++, Scheme, and Prolog ..................... 409
B. l Introduction to operating systems ...................................................................................... 409
B.2 Introduction to Unix and CIC++ programming environments........................................... 412
B.2.1 Unix and Linux operating systems 412
B.2.2 Unix shell and commands 413
B.2.3 Unix system calls 417
B.2.4 Getting started with GNU GCC under the Unix operating system 419
B.2.5 Debugging your CIC++ programs in GNC GCC 421
B.2.6 Frequently used GCC compiler options 424
B.2.7 CIC++ operators 424
B.2.8 Download programming development environments and tutorials 426
BJ Getting started with Visual Studio programming environment ......................................... 426
B.3.1 Creating a CIC++ project in Visual Studio 427
B.3.2 Debugging your CIC++ programs in Visual Studio 429
B.4 Programming environments supporting Scheme programming ........................................ 430
B.4.1 Getting started with DrRacket 430
B.4.2 Download DrRacket programming environment 431
B.5 Programming environments supporting Prolog programming .......................................... 432
B.5.1 Getting started with the GNU Prolog environment 432
B.5.2 Getting started with Prolog programming 433
B.5.3 Download Prolog programming development tools 435
Appendix C ASCII Character Table ................................................................................................... 437
Bibliography ........................................................................................................................................... 439
Index ........................................................................................................................................... 443
ix
Preface
We all have witnessed the rapid development of computer science and its applications in many domains,
particularly in web-based computing (Web 2.0), cloud computing, big data processing, and mobile
computing. As a science discipline, the fundamentals of computer science, including programming
language principles and the classic programming languages, are stable and do not change with the
technological innovations. C, C++, Scheme/LISP, and Prolog belong to the classic programming languages
that were developed several decades ago and are still the most significant programming languages today,
both in theory and in practice. However, the technologies that surround these languages have been changed
and improved, which give these languages new perspectives and new applications. For example, C++ is
extended to generic classes and writing multithread programs. Functional programming principles are
widely used in database query languages and the new object- and service-oriented programming languages
such as C#.
This text is intended for computer science and computer engineering students in their sophomore year of
study. It is assumed that students have completed a basic computer science course and have learned a high
level programming language like C, C++, or Java.
Most of the content presented in the text has been used in the "Introduction to Programming Languages"
course taught by the author in the School of Computer Science at the University of the Witwatersrand at
Johannesburg, and in the Computer Science and Engineering programs at Arizona State University. This
text is different from the existing texts on programming languages that either focus on teaching
programming paradigms, principles, and the language mechanisms, or focus on language constructs and
programming skills. This text takes a balanced approach on both sides. It teaches four programming
languages representing four major programming paradigms. Programming paradigms, principles, and
language mechanisms are used as the vehicle to facilitate learning of the four programming languages in a
coherent way. The goals of such a programming course are to make sure that computer science students are
exposed to different programming paradigms and language mechanisms, and obtain sufficient
programming skills and experience in different programming languages, so that they can quickly use these
or similar languages in other courses.
Although there are many different programming paradigms, imperative, object-oriented, functional, and
logic programming paradigms are the four major paradigms widely taught in computer science and
computer engineering departments around the world. The four languages we will study in the text are the
imperative C, object-oriented C++, functional Scheme, and logic Prolog. At the end of the course, students
should understand
• the language structures at different layers (lexical, syntactic, contextual, and semantic), the control
structures and the execution models of imperative, object-oriented, functional, and logic
programming languages;
• program processing (compilation versus interpretation) and preprocessing (macros and inlining);
• different aspects of a variable, including its type, scope, name, address, memory location, and value.
More specific features of programming languages and programming issues are explored in cooperation with
the four selected languages. Students are expected to have understood and be able to
• write C programs with complex data types, including pointers, arrays, and generic structures, as
well as programs with static and dynamic memory allocation;
xi
• apply the object-oriented features such as inheritance and class hierarchy, polymorphism and
typing, overloading, early versus late binding, as well as the constructors, the destructor and the
management of static memory, stack, and heap in C++;
• apply the functional programming style of parameter passing and write Scheme programs requiring
multiple functions;
• apply the logic programming style of parameter passing, write Prolog facts, rules, and goals, and
use multiple rules to solve problems;
• be able to write programs requiring multiple subprograms/procedures to solve large programming
problems;
• be able to write recursive subprograms/procedures in imperative, object-oriented, functional, and
logic programming languages.
The text has been revised and improved throughout in each of the new editions. In the second edition, the
major change made was the inclusion of programming in Service-Oriented Architecture (SOA). Since the
publication of the first edition in 2003, SOA programming has emerged as a new programming paradigm,
which has demonstrated its strength to become a dominating programming paradigm. All major computing
companies, including HP, IBM, Intel, Microsoft, Oracle, SAP, and Sun Microsystems, have moved into
this new paradigm and are using the new paradigm to produce software and even hardware systems. The
need for skill in SOA programming increases as the deployment of SOA applications increases. This new
SOA paradigm is not only important in the practice of programming, but it also contributes to the concepts
and principles of programming theory. In fact, SOA programming applies a higher level of abstraction,
which requires fewer technical details for building large software applications. We, the authors of this book,
are leading researchers and educators in SOA programming. The inclusion of the new chapter on C# and
SOA programming makes the text unique, which allows teaching of the most contemporary programming
concepts and practice. The new chapter also gives professors a new component to choose from, which adds
flexibility for them to select different contents for different courses. As SOA has developed significantly in
the past 10 years, this chapter is also updated in the fourth edition to include an introduction to Silverlight
animation, phone application development, cloud computing, and big data processing.
In the third edition, we completely rewrite Chapter 5. We also discuss the modem applications of Prolog in
the semantic web (Web 3.0) and its relationship with the currently used web semantic languages RDF
(Resource Description Framework) and OWL (Web Ontology Language). Semantic web is considered the
next generation of web that allows the web to be browsed and explored by both humans and computer
programs. In the third edition revised print, this chapter is further expanded with the latest computing
technologies in cloud computing and big data processing.
Since the publication of the second edition in 2006, the programming environment for Chapter 4, on
Scheme, has been changed from DrScheme to DrRacket. The change does not affect the examples in the
text. They all work in the new DrRacket environment, except certain notational issues. We have updated
Chapter 4 to match the changes made in DrRacket.
As parallel computing and multithreading are becoming more and more important in software development,
the third edition adds a new section on parallel computing and multithreading in C++, in Chapter 3. A
MapReduce example is used as a case study for explaining multithreading in C++. The parallel computing
concept is also emphasized in Chapter 4, where the eager evaluation and higher functions Map and Reduce
are linked to parallel computing.
In the fourth edition, we added a number of new sections and many examples throughout Chapters 1, 2, 3,
4, 5, and 6 to explain the more difficulty concepts. In Chapter 1, macro expansion and execution are
explained in more detail and the order of executions are discussed and showed on different programming
environments. More complex examples of syntax graphs are given in Section 1.2. In Chapter 2, structure
padding is discussed in Section 2.5. The file operations in Section 2.6 are extended. More recursive
xii
examples are given in Section 2.7. A case study that puts a11 together is given in a new section at the end of
the chapter. In Chapter 3, a new subsection on memory leak detection is added in Section 3.3 on memory
management. Section 3.4 on inheritance is extended with a new subsection on type casting. A new section
on C++ file operations is added as Section 3.5. In Chapter 4, the application of filtering in query languages
is added in Section 4.9. In the new editions, Chapter 5 is further extended to include web application and
phone application development in C#. It also extends the discussions to cloud computing and big data
processing.
In the fifth edition, changes and revisions are made throughout the book. In Chapter 2, more data structures
are discussed, including doubly linked list, graphs, and trees. Chapter 3, Object-Oriented Programming
Language C++, is significantly extended to include inheritance, type casting, function overloading and
operator overloading, and C++ file operations. A new section 3.8 Case Study is included to put together all
the concepts and programming mechanisms learned in this chapter. In Appendix B, tutorials on using GNU
GCC environment and Visual Studio environment to edit and debug programs are added.
This edition of the text is organized into six chapters and three appendices. Chapter 1 discusses the
programming paradigms, principles, and common aspects of programming languages. Chapter 2 uses C as
the example of the imperative programming paradigm to teach how to write imperative programs. It is
assumed that students have a basic understanding of a high-level programming language such as C, C++,
or Java. Chapter 3 extends the discussion and programming from C to C++. The chapter focuses on the
main features of object-oriented programming paradigms, including class composition, dynamic memory
management and garbage collection, inheritance, dynamic memory allocation and deallocation, late
binding, polymorphism, and class hierarchy. Chapters 4 and 5 take a major paradigm shift to teach
functional and logic programming, respectively. Students are not required to have any knowledge of
functional and logic programming to learn from these two chapters. Chapter 6 gives a brief introduction to
C# and service-oriented computing paradigm. A full discussion of the service-oriented computing paradigm
is given in another book by the authors: Service-Oriented Computing and Web Software Integration.
Assignments, programming exercises, and projects are given at the end of each chapter. The sections with
an asterisk(*) are optional and can be skipped if time does not permit covering all the material. Chapters 4
and 5 are self-contained and can be taught independently, or in a different order.
The three appendices provide supplementary materials to the main text. In Appendix A, the basic computer
organization and assembly language programming are introduced. If students do not have a basic computer
science background, the material should be covered in the class. Appendix B starts with basic Unix
commands. If the class uses a Unix-based laboratory environment, students can read the appendix to get
started with Unix. Then the appendix introduces the major programming language environments that can
be used to support teaching the four programming languages, including GNU GCC/G++ for C and C++,
Visual Studio for C and C++, DrRacket for Scheme, and GNU Prolog. Appendix C gives the ASCII code
table that is referred to in various parts of the text.
The text consists of six chapters, which can be considered reconfigurable components of a course. A half
semester course(25-30 lecture hours) can teach from two to three chapters, and a full semester course can
teach four to five chapters of choice from the text. Chapter 3(C++) is closely related to Chapter 2. If Chapter
3 is selected as a component of a course, Chapter 2, or a part of Chapter 2, should be selected as well. Other
chapters are relatively independent of each other and can be selected freely to compose a course.
For a half-semester course, sensible course compositions could include: (Chapters 1, 2, 3);(Chapters 2, 3);
(Chapters 1, 2, 6); (Chapters 2, 3, 6); (Chapters 1, 4, 5); and (Chapters 4, 5). For a full semester course,
sensible course compositions could include: (chapters 1, 2, 3, 4, 5); (chapters 1, 2, 3, 4, 6); (Chapters 1, 2,
3, 5, 6); and(Chapters 2, 3, 4, 5, 6).
I wish to thank all those who have contributed to the materials and to the formation of this text. Particularly,
I would like to thank my colleagues Scott Hazelhurst and Conrad Mueller of the University of the
Xlll
Witwatersrand, and Richard Whitehouse of Arizona State University who shared their course materials
with me. Parts of these materials were used in teaching the programming languages course and in preparing
this text. Thomas Boyd, Joe DeLibero, Renee Turban, and Wei-Tek Tsai of Arizona State University
reviewed the drafts of the text and made constructive suggestions and useful comments. Other instructors
using this text have given me invaluable feedback and improvement suggestions, including Janaka
Balasooriya, Calvin Cheng, Mutsumi Nakamura, and Yalin Wang. My teaching assistants helped me in the
past few years to prepare the assignments and programming exercises; particularly, I would like to thank
Ruben Acuna, Raynette Brodie, Justin Convery, Gennaro De Luca, Garrett Gutierrez, and Kevin Liao.
The text was written and revised while I was carrying out a full university workload. I am thankful to my
family. I could not imagine that I would be able to complete the task without their generous support by
allowing me to use most of the weekends in the past year to write the text.
Although I have used the materials in teaching the programming languages courses at the University of the
Witwatersrand, Johannesburg and at Arizona State University for several years, the text was put together
in a short period of time. There are certainly many errors of different kinds. I would appreciate it if you
could send me any corrections, comments, or suggestions for improving the text. My email address
dedicated to dealing with the responses to the text is <[email protected]>. Instructors who use the text
can contact the author for instructional support, including lecture slides in PowerPoint format and the
solutions to the assignments.
Yinong Chen
December 2016
XIV
Chapter 1
Basic Principles of Programming Languages
Although there exist many programming languages, the differences among them are insignificant compared
to the differences among natural languages. In this chapter, we discuss the common aspects shared among
different programming languages. These aspects include:
• programming paradigms that define how computation is expressed;
• the main features of programming languages and their impact on the performance of programs
written in the languages;
• a brief review of the history and development of programming languages;
• the lexical, syntactic, and semantic structures of programming languages, data and data types,
program processing and preprocessing, and the life cycles of program development.
At the end of the chapter, you should have learned:
• what programming paradigms are;
• an overview of different programming languages and the background knowledge of these
languages;
• the structures of programming languages and how programming languages are defined at the
syntactic level;
• data types, strong versus weak checking;
• the relationship between language features and their performances;
• the processing and preprocessing of programming languages, compilation versus interpretation,
and different execution models of macros, procedures, and inline procedures;
• the steps used for program development: requirement, specification, design, implementation,
testing, and the correctness proof of programs.
The chapter is organized as follows. Section 1.1 introduces the programming paradigms, performance,
features, and the development of programming languages. Section 1.2 outlines the structures and design
issues of programming languages. Section 1.3 discusses the typing systems, including types of variables,
type equivalence, type conversion, and type checking during the compilation. Section 1.4 presents the
preprocessing and processing of programming languages, including macro processing, interpretation, and
compilation. Finally, Section 1.5 discusses the program development steps, including specification, testing,
and correctness proof.
1
1.1 Introduction
1.1.1 Programming concepts and paradigms
Millions of programming languages have been invented, and several thousands of them are actually in use.
Compared to natural languages that developed and evolved independently, programming languages are far
more similar to each other. This is because
• different programming languages share the same mathematical foundation (e.g., Boolean algebra,
logic);
• they provide similar functionality (e.g., arithmetic, logic operations, and text processing);
• they are based on the same kind of hardware and instruction sets;
• they have common design goals: find languages that make it simple for humans to use and efficient
for hardware to execute;
• designers of programming languages share their design experiences.
Some programming languages, however, are more similar to each other, while other programming
languages are more different from each other. Based on their similarities or the paradigms, programming
languages can be divided into different classes. In programming language's definition, paradigm is a set
of basic principles, concepts, and methods for how a computation or algorithm is expressed. The major
paradigms we wilJ study in this text are imperative, object-oriented, functional, and logic paradigms.
The imperative, also called the procedural, programming paradigm expresses computation by fully
specified and fully controlled manipulation of named data in a stepwise fashion. In other words, data or
values are initially stored in variables (memory locations), taken out of (read from) memory, manipulated
in ALU (arithmetic logic unit), and then stored back in the same or different variables (memory locations).
Finally, the values of variables are sent to the 1/0 devices as output. The foundation of imperative languages
is the stored program concept-based computer hardware organization and architecture (von Neumann
machine). The stored program concept will be further explained in the next chapter. Typical imperative
programming languages include all assembly languages and earlier high-level languages like Fortran,
Algol, Ada, Pascal, and C.
The object-oriented programming paradigm is basically the same as the imperative paradigm, except that
related variables and operations on variables are organized into classes of objects. The access privileges of
variables and methods (operations) in objects can be defined to reduce (simplify) the interaction among
objects. Objects are considered the main building blocks of programs, which support language features like
inheritance, class hierarchy, and polymorphism. Typical object-oriented programming languages include
Smalltalk, C++, Java, and C#.
The functional, also called the applicative, programming paradigm expresses computation in terms of
mathematical functions. Since we express computation in mathematical functions in many of the
mathematics courses, functional programming is supposed to be easy to understand and simple to use.
However, since functional programming is very different from imperative or object-oriented programming,
and most programmers first get used to writing programs in imperative or object-oriented paradigms, it
becomes difficult to switch to functional programming. The main difference is that there is no concept of
memory locations in functional programming languages. Each function will take a number of values as
input (parameters) and produce a single return value (output of the function). The return value cannot be
stored for later use. It has to be used either as the final output or immediately as the parameter value of
another function. Functional programming is about defining functions and organizing the return values of
one or more functions as the parameters of another function. Functional programming languages are mainly
2
based on the lambda calculus that will be discussed in Chapter 4. Typical functional programming
languages include ML, SML, and Lisp/Scheme.
The logic, also called the declarative, programming paradigm expresses computation in terms of logic
predicates. A logic program is a set of facts, rules, and questions. The execution process of a logic program
is to compare a question to each fact and rule in the given fact and rulebase. If the question finds a match,
we receive a yes answer to the question. Otherwise, we receive a no answer to the question. Logic
programming is about finding facts, defining rules based on the facts, and writing questions to express the
problems we wish to solve. Prolog is the only significant logic programming language.
It is worthwhile to note that many languages belong to multiple paradigms. For example, we can say that
C++ is an object-oriented programming language. However, C++ includes almost every feature of C and
thus is an imperative programming language too. We can use C++ to write C programs. Java is more object
oriented, but still includes many imperative features. For example, Java's primitive type variables do not
obtain memory from the language heap like other objects. Lisp contains many nonfunctional features.
Scheme can be considered a subset of Lisp with fewer nonfunctional features. Prolog's arithmetic
operations are based on the imperative paradigm.
Nonetheless, we will focus on the paradigm-related features of the languages when we study the sample
languages in the next four chapters. We will study the imperative features of C in Chapter 2, the object
oriented features of C++ in Chapter 3, and the functional features of Scheme and logic features of Prolog
in Chapters 4 and 5, respectively.
1.1.2 Program performance and features of programming languages
A programming language's features include orthogonality or simplicity, available control structures, data
types and data structures, syntax design, support for abstraction, expressiveness, type equivalence, and
strong versus weak type checking, exception handling, and restricted aliasing. These features will be further
explained in the rest of the book. The performance of a program, including reliability, readability,
writability, reusability, and efficiency, is largely determined by the way the programmer writes the
algorithm and selects the data structures, as well as other implementation details. However, the features of
the programming language are vital in supporting and enforcing programmers in using proper language
mechanisms in implementing the algorithms and data structures. Table 1.1 shows the influence of a
language's features on the performance of a program written in that language.
Readability/
L� Efficiency Reusability Writability Reliability
Simplicity/Orthogonality ✓ ✓ ✓ ✓
Control structures ✓ ✓ ✓ ✓
Typing and data structures ✓ ✓ ✓ ✓
Syntax design ✓ ✓ ✓
Support for abstraction ✓ ✓ ✓
Expressiveness ✓ ✓
Strong checking ✓
Restricted aliasing ✓
Exception handling ✓
3
The table indicates that simplicity, control structures, data types, and data structures have significant impact
on all aspects of performance. Syntax design and the support for abstraction are important for readability,
reusability, writability, and reliability. However, they do not have a significant impact on the efficiency of
the program. Expressiveness supports writability, but it may have a negative impact on the reliability of the
program. Strong type checking and restricted aliasing reduce the expressiveness of writing programs, but
are generally considered to produce more reliable programs. Exception handling prevents the program from
crashing due to unexpected circumstances and semantic errors in the program. All language features will
be discussed in this book.
1.1.3 Development of programming languages
The development of programming languages has been influenced by the development of hardware, the
development of compiler technology, and the user's need for writing high-performance programs in terms
of reliability, readability, writability, reusability, and efficiency. The hardware and compiler limitations
have forced early programming languages to be close to the machine language. Machine languages are the
native languages of computers and the first generation of programming languages used by humans to
communicate with the computer.
Machine languages consist of instructions of pure binary numbers that are difficult for humans to remember.
The next step in programming language development is the use of mnemonics that allows certain symbols
to be used to represent frequently used bit patterns. The machine language with sophisticated use of
mnemonics is called assembly language. An assembly language normally allows simple variables, branch
to a label address, different addressing modes, and macros that represent a number of instructions. An
assembler is used to translate an assembly language program into the machine language program. The
typical work that an assembler does is to translate mnemonic symbols into corresponding binary numbers,
substitute register numbers or memory locations for the variables, and calculate the destination address of
branch instructions according to the position of the labels in the program.
This text will focus on introducing high-level programming languages in imperative, object-oriented,
functional, and logic paradigms.
The first high-level programming language can be traced to Konrad Zuse's Plankalkiil programming system
in Germany in 1946. Zuse developed his Z-machines Zl, Z2, Z3, and Z4 in the late 1930s and early 1940s,
and the Plankalkill system was developed on the Z4 machine at ETH (Eidgenossisch Technische
Hochschule) in Ztirich, with which Zuse designed a chess-playing program.
The first high-level programming language that was actually used in an electronic computing device was
developed in 1949. The language was named Short Code. There was no compiler designed for the language,
and programs written in the language had to be hand-compiled into the machine code.
The invention of the compiler was credited to Grace Hopper, who designed the first widely known
compiler, called AO, in 1951.
The first primitive compiler, called Autocoder, was written by Alick E. Glennie in 1952. It translated
Autocode programs in symbolic statements into machine language for the Manchester Mark I computer.
Autocode could handle single letter identifiers and simple formulas.
The first widely used language, Fortran (FORmula TRANslating), was developed by the team headed by
John Backus at IBM between 1954 and 1957. Backus was also the system co-designer of the IBM 704 that
ran the first Fortran compiler. Backus was later involved in the development of the language Algol and the
Backus-Naur Form (BNF). BNF was a formal notation used to define the syntax of programming languages.
Fortran II came in 1958. Fortran III came at the end of 1958, but it was never released to the public. Further
versions of Fortran include ASA Fortran 66 (Fortran IV) in 1966, ANSI Fortran 77 (Fortran V) in 1978,
4
ISO Fortran 90 in 1991, and ISO Fortran 95 in 1997. Unlike assembly languages, the early versions of
Fortran allowed different types of variables (real, integer, array), supported procedure call, and included
simple control structures.
Programs written in programming languages before the emergence of structured programming concepts
were characterized as spaghetti programming or monolithic programming. Structured programming is a
technique for organizing programs in a hierarchy of modules. Each module had a single entry and a single
exit point. Control was passed downward through the structure without unconditional branches (e.g., goto
statements) to higher levels of the structure. Only three types of control structures were used: sequential,
conditional branch, and iteration.
Based on the experience of Fortran I, Algol 58 was announced in 1958. Two years later, Algol 60, the first
block-structured language, was introduced. The language was revised in 1963 and 1968. Edsger Dijkstra is
credited with the design of the first Algol 60 compiler. He is famous as the leader in introducing structured
programming and in abolishing the goto statement from programming.
Rooted in Algol, Pascal was developed by Niklaus Wirth between 1968 and 1970. He further developed
Modula as the successor of Pascal in 1977, then Modula-2 in 1980, and Oberon in 1988. Oberon language
had Pascal-like syntax, but it was strongly typed. It also offered type extension (inheritance) that supported
object-oriented programming. In Oberon-2, type-bound procedures (like methods in object-oriented
programming languages) were introduced.
The C programming language was invented and first implemented by Dennis Ritchie at DEC between 1969
and 1973, as a system implementation language for the nascent Unix operating system. It soon became one
of the dominant languages at the time and even today. The predecessors of C were the typeless language
BCPL (Basic Combined Programming Language) by Martin Richards in 1967 and then the B written by
Ken Thompson in 1969. C had a weak type checking structure to allow a higher level of programming
flexibility.
Object-oriented (00) programming concepts were first introduced and implemented in the Simula
language, which was designed by Ole-Johan Dahl and Kristen Nygaard at the Norwegian Computing Center
(NCC) between 1962 and 1967. The original version, Simula I, was designed as a language for discrete
event simulation. However, its revised version, Simula 67, was a full-scale general-purpose programming
language. Although Simula never became widely used, the language was highly influential on the modern
programming paradigms. It introduced important object-oriented concepts like classes and objects,
inheritance, and late binding.
One of the object-oriented successors of Simula was Smalltalk, designed at Xerox PARC, led by Alan Kay.
The versions developed included Smalltalk-72, Smalltalk-74, Smalltalk-76, and Smalltalk-80. Smalltalk
also inherited functional programming features from Lisp.
Based on Simula 67 and C, a language called "C with classes" was developed by Bjarne Stroustrup in 1980
at Bell Labs, and then revised and renamed as C++ in 1983. C++ was considered a better C (e.g., with
strong type checking), plus it supported data abstraction and object-oriented programming inherited from
Simula 67.
Java was written by Ja mes Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan at Sun
Microsystems. It was called Oak at first and then renamed Java when it was publicly announced in 1995.
The predecessors of Ja va were C++ and Smalltalk. Java removed most non-object-oriented features of C++
and was a simpler and better object-oriented programming language. Its two-level program processing
concept (i.e., compilation into an intermediate bytecode and then interpretation of the bytecode using a
small virtual machine) made it the dominant language for programming Internet applications. Java was still
5
not a pure object-oriented programming language. Its primitive types, integer, floating-point number,
Boolean, etc., were not classes, and their memory allocations were from the language stack rather than from
the language heap.
Microsoft's C# language was first announced in June 2000. The language was derived from C++ and Java.
It was implemented as a full object-oriented language without "primitive" types. C# also emphasizes
component-oriented programming, which is a refined version of object-oriented programming. The idea is
to be able to assemble software systems from prefabricated components.
Functional programming languages are relatively independent of the development process of imperative
and object-oriented programming languages. The first and most important functional programming
language, Lisp, short for LISt Processing, was developed by John McCarthy at MIT. Lisp was first released
in 1958. Then Lisp 1 appeared in 1959, Lisp 1.5 in 1962, and Lisp 2 in 1966. Lisp was developed
specifically for artificial intelligence applications and was based on the lambda calculus. It inherited its
algebraic syntax from Fortran and its symbol manipulation from the Information Processing Language, or
IPL. Several dialects of Lisp were designed later, for example, Scheme, InterLisp, FranzLisp, MacLisp, and
ZetaLisp.
As a Lisp dialect, Scheme was first developed by G. L. Steele and G. J. Sussman in 1975 at MIT. Several
important improvements were made in its later versions, including better scope rule, procedures (functions)
as the first-class objects, removal of loops, and sole reliance on recursive procedure calls to express loops.
Scheme was standardized by the IEEE in 1989.
Efforts began on developing a common dialect of Lisp, referred to as Common Lisp, in 1981. Common
Lisp was intended to be compatible with all existing versions of Lisp dialects and to create a huge
commercial product. However, the attempt to merge Scheme into Lisp failed, and Scheme remains an
independent Lisp dialect today. Common Lisp was standardized by the IEEE in 1992.
Other than Lisp, John Backus's FP language also belongs to the first functional programming languages.
FP was not based on the lambda calculus, but based on a few rules for combining function forms. Backus
felt that lambda calculus's expressiveness on computable functions was much broader than necessary. A
simplified rule set could do a better job.
At the same time that FP was developed in the United States, ML (Meta Language) appeared in the United
Kingdom. Like Lisp, ML was based on lambda calculus. However, Lisp was not typed (no variable needs
to be declared), while ML was strongly typed, although users did not have to declare variables that could
be inferentially determined by the compiler.
Miranda is a pure functional programming language developed by David Turner at the University of Kent
in 1985-1986. Miranda achieves referential transparency (side effect-free) by forbidding modification to
global variables. It combines the main features of SASL (St. Andrews Static Language) and KRC (Kent
Recursive Calculator) with strong typing similar to that of ML. SASL and KRC are two earlier functional
programming languages designed by Turner at the University of St Andrews in 1976 and at the University
of Kent in 1981, respectively.
There are many logic-based programming languages in existence. For example, ALF (Algebraic Logic
Functional language) is an integrated functional and logic language based on Hom clauses for logic
programming, and functions and equations for functional programming. Godel is a strongly typed logic
programming language. The type system is based on a many-sorted logic with parametric polymorphism.
RELFUN extends Horn logic by using higher-order syntax, first-class finite domains, and expressions of
nondeterministic, nonground functions, explicitly distinguished from structures.
6
Random documents with unrelated
content Scribd suggests to you:
and legs exposed to view. George Ives’ horse was blanketed in the
same way. It was a dappled gray, with a roached mane. He himself
was masked with a piece of a gray blanket, with the necessary
perforations. Zachary rode a blue-gray horse, belonging to Bob
Dempsey, (“All the country” was their stable)—blanketed like the
others—and his mask was a piece of a Jersey shirt.
Ives was on the off side of the driver, and Graves on the near side.
When Zachary walked up to Southmayde, he said, “Shut your eyes.”
This Southmayde respectfully declined, and the matter was not
pressed. Bob then took Leroy’s pistol and money, and threw them
down.
While Southmayde was being robbed, Billy, feeling tired, put down
his hands; upon which Ives instantly roared out, “Throw them up, you
——.” It is recorded that Billy obeyed with alacrity, though not with
cheerfulness.
Zachary walked up to Captain Moore and made a similar request.
The Captain declared with great solemnity, as he handed him his
purse, that it was “All he had in the world;” but it afterwards appeared
that a sum of $25 was not included in that estimate of his terrestial
assets; for he produced this money when the Road Agents had
disappeared.
Continuing his search, the relieving officer came to Billy, and
demanded his pistol, which was immediately handed over. Ives
asked, “Is it loaded,” and being answered in the negative, told Bob to
give it back to the owner. Tom Caldwell’s turn came next. He had
several small sums belonging to different parties, which he was
carrying for them to their friends, and also he had been
commissioned to make some purchases. As Bob approached him,
he exclaimed, “My God! what do you want with me; I have nothing.”
Graves told Zachary to let him alone, and inquired if there was
anything in the mail that they wanted. Tom said he did not think that
there was. Zachary stepped upon the brake bar and commenced an
examination, but found nothing. As Caldwell looked at Zachary while
he was thus occupied, Ives ordered him not to do that. Tom turned
and asked if he might look at him. Ives nodded.
Having finished his search, Zachary picked up his gun, and
stepped back. Ives dismissed the “parade” with the laconic
command, “Get up and ‘skedaddle.’”
The horses were somewhat restive, but Tom held them fast, and
Southmayde, with a view to reconnoitering, said in a whisper, “Tom,
drive slow.” Ives called out, “Drive on.” Leroy turned round on his
seat, determined to find out who the robbers were, and looked
carefully at them for nearly a minute, which Ives at last observing, he
yelled out, “If you don’t turn round, and mind your business, I’ll shoot
the top of your head off.” The three robbers gathered together, and
remained watching, till the coach was out of sight.
Leroy Southmayde lost $400 in gold, and Captain Moore delivered
up $100 in Treasury Notes, belonging to another man.
The coach proceeded on its way to Bannack without further
molestation, and on its arrival there, Plummer was in waiting, and
asked, “Was the coach robbed to-day?” and being told that it had
been, as Southmayde jumped down, he took him by the arm, and
knowing him to be Sheriff, Southmayde was just about to tell him all
about it, when Judge G. G. Bissell gave Leroy a slight nudge, and
motioned for him to step back, which he did, and the Judge told him
to be very careful what he told that man, meaning Plummer;
Southmayde closed one eye as a private signal of comprehension,
and rejoined Plummer, who said, “I think I can tell you who it was
that robbed you.” Leroy asked, “Who?” Plummer replied, “George
Ives was one of them.” Southmayde said, “I know; and the others
were Whiskey Bill and Bob Zachary; and I’ll live to see them hanged
before three weeks.” Plummer at once walked off, and though Leroy
was in town for three days, he never saw him afterwards. The object
of Plummer’s accusation of Ives was to see whether Southmayde
really knew anything. Some time after, Judge Bissell—who had
overheard Southmayde telling Plummer who the thieves were—
remarked to him, “Leroy, your life is not worth a cent.”
On the second day after, as Tom was returning, he saw Graves at
the Cold Spring Ranch, and took him on one side asking him if he
had heard of the “little robbery.” Graves replied that he had, and
asked him if he knew who were the perpetrators. Tom said, “No,”
adding, “And I wouldn’t for the world; for if I did, and told of them, I
shouldn’t live long.” “That’s a fact, Tom,” said Graves, “You wouldn’t
live fifteen minutes. I’ll tell you of a circumstance as happened to me
about bein’ robbed in Californy:
“One night about ten o’clock, me and my partner was ridin’ along,
and two fellers rode up and told us to throw up our hands, and give
up our money. We did it pretty quick I guess. They got $2,000 in
coined gold from us. I told ’em, ‘Boys,’ sez I, ‘It’s pretty rough to take
all we’ve got.’ So the feller said it was rather rough, and he gave us
back $40. About a week after, I seen the two fellers dealin’ Faro. I
looked pretty hard at them, and went out. One of the chaps follered
me, and sez he, ‘Ain’t you the man that was robbed the other night?’
‘No,’ sez I, for I was afraid to tell him the truth. Sez he, ‘I want you to
own up; I know you’re the man. Now I’m agoing to give you $4,000
for keeping your mouth shut,’ and he did, ——. Now you see, Tom,
that’s what I got for keepin’ my mouth shut. I saved my life, and got
$4,000.”
Ives made for Virginia City, and there told, in a house of ill-fame,
that he was the Bamboo chief that made Tom Caldwell throw up his
hands, and that, ——, he would do it again. He and a Colorado
driver, who was a friend of Caldwell’s went together to Nevada. Each
of them had a shot-gun. Ives was intoxicated. The driver asked Ives
whom did he suppose to be the robbers; to which he quickly replied,
“I am the Bamboo chief that robbed it,” etc., etc., as before
mentioned. The man then said, “Don’t you think Tom knows it?” “Of
course I do,” said George. As they came back to town, the driver
saw Tom, and waved to him to keep back, which he did, and sent a
man to inquire the reason of the signal. The messenger brought him
back information of what had passed, and told him to keep out of
Ives’ way, for he was drunk and might kill him.
The same evening, Tom and his friend went to the Cold Spring
Ranch together, on the coach, and the entire particulars came out, in
conversation. The driver finished the story by stating that he sat on
his horse, ready to shoot Ives, if he should succeed in getting the
“drop” on Caldwell.
Three days after, when Southmayde was about to return from
Bannack, Buck Stinson and Ned Ray came into the Express Office,
and asked who were for Virginia. On being told that there were none
but Southmayde, they said, “Well, then, we’ll go.” The Agent came
over and said to Leroy, “For God’s sake, don’t go; I believe you’ll be
killed.” Southmayde replied, “I have got to go; and if you’ll get me a
double-barrelled shot gun, I will take my chances.” Oliver’s Agent
accordingly provided Leroy Southmayde, Tom Caldwell, and a young
lad about sixteen years of age, who was also going by the coach to
Virginia, with a shot gun each. Leroy rode with Tom. They kept a
keen eye on a pair of Road Agents, one driving and the other
watching.
The journey was as monotonous as a night picket, until the coach
reached the crossing of the Stinkingwater, where two of the three
men that robbed it (Bob Zachary and Bill Graves) were together, in
front of the station, along with Aleck Carter. Buck Stinson saw them,
and shouted, “Ho! you —— Road Agents.” Said Leroy to Tom
Caldwell, “Tom, we’re gone up.” Said Tom, “That’s so.”
At the Cold Spring Station, where the coach stopped for supper,
the amiable trio came up. They were, of course fully armed with gun,
pistols and knife. Two of them set down their guns at the door, and
came in. Aleck Carter had his gun slung at his back. Bob Zachary
feigning to be drunk, called out, “I’d like to see the —— man that
don’t like Stone.” Finding that, as far as could be ascertained,
everybody present, had a very high opinion of Stone, he called for a
treat to all hands, which having been disposed of, he bought a bottle
of whiskey and behaved “miscellaneously” till the coach started.
After going about a quarter of a mile, they wheeled their horses
and called “Halt.” The instant the word left their lips, Leroy dropped
his gun on Aleck Carter; Tom Caldwell, and the other passenger
each picked his man, and drew a bead on him, at the same moment.
Aleck Carter called out, “We only want you to take a drink; but you
can shoot and be ——, if you want to.” Producing the bottle, it was
handed round; but Leroy and Tom only touched their lips to it. Tom
believed it to be poisoned. After politely inquiring if any of the ——
wanted any more, they wheeled their horses, saying, “We’re off for
Pete Daley’s,” and clapped spurs to their horses, and headed for the
Ranch, going on a keen run.
Before leaving Cold Spring Ranch, Leroy Southmayde told Tom
that he saw through it all, and would leave the coach; but Tom said
he would take Buck up beside him, and that surely the other fellow
could watch Ray. Buck did not like the arrangement; but Tom said,
“You’re an old driver, and I want you up with me, ——.”
The two passengers sat with their shot guns across their knees,
ready for a move on the part of either of the robbers.
At Lorraine’s Ranch, Leroy and Caldwell went out a little way from
the place, with the bridles in their hands, and talked about the
“situation.” They agreed that it was pretty rough, and were debating
the propriety of taking to the brush, and leaving the coach, when
their peace of mind was in no way assured by seeing that Buck
Stinson was close to them, and must have overheard every word
they had uttered. Buck endeavored to allay their fears by saying
there was no danger. They told him that they were armed, and that if
they were attacked, they would make it a warm time for some of
them; at any rate, they would “get” three or four of them. Buck
replied, “Gentlemen, I pledge you my word, my honor, and my life,
that you will not be attacked between this and Virginia.”
The coach went on, directly the horses were hitched up, and Buck
commenced roaring out a song, without intermission, till at last he
became tired, and then, at his request, Ray took up the chorus. This
was the signal to the other three to keep off. Had the song ceased,
an attack would have been at once made, but, without going into
Algebra, they were able to ascertain that such a venture had more
peril than profit, and so they let it alone. The driver, Southmayde and
the young passenger were not sorry when they alighted safe in town.
Ned Ray called on Southmayde and told him that if he knew who
committed the robbery he should not tell; for that death would be his
portion if he did.
CHAPTER XIV.
THE OPENING OF THE BALL—GEORGE IVES.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookfinal.com