Thanks to visit codestin.com
Credit goes to www.scribd.com

100% found this document useful (2 votes)
71 views56 pages

Foundations of Programming Languages Kent D. Lee Download

The document provides information about the book 'Foundations of Programming Languages' by Kent D. Lee, including links to download the book and other related texts. It emphasizes the importance of understanding programming paradigms and the interactive nature of the text, which includes exercises and projects for students. The book aims to equip readers with the tools necessary for a career in computer science, focusing on object-oriented, functional, and logic programming.

Uploaded by

dwgbvxsij7069
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
71 views56 pages

Foundations of Programming Languages Kent D. Lee Download

The document provides information about the book 'Foundations of Programming Languages' by Kent D. Lee, including links to download the book and other related texts. It emphasizes the importance of understanding programming paradigms and the interactive nature of the text, which includes exercises and projects for students. The book aims to equip readers with the tools necessary for a career in computer science, focusing on object-oriented, functional, and logic programming.

Uploaded by

dwgbvxsij7069
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

Foundations of Programming Languages Kent D.

Lee
pdf download

https://textbookfull.com/product/foundations-of-programming-
languages-kent-d-lee/

Download more ebook instantly today - get yours now at textbookfull.com


We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!

Foundations of Programming Languages Second Edition Lee

https://textbookfull.com/product/foundations-of-programming-
languages-second-edition-lee/

Practical Foundations For Programming Languages 2nd


Edition Robert Harper

https://textbookfull.com/product/practical-foundations-for-
programming-languages-2nd-edition-robert-harper/

Concepts of programming languages Twelfth Edition


Sebesta

https://textbookfull.com/product/concepts-of-programming-
languages-twelfth-edition-sebesta/

Concepts of programming languages 11th Edition Sebesta

https://textbookfull.com/product/concepts-of-programming-
languages-11th-edition-sebesta/
Programming Languages and Systems Amal Ahmed

https://textbookfull.com/product/programming-languages-and-
systems-amal-ahmed/

Transactions on Pattern Languages of Programming IV


James Noble

https://textbookfull.com/product/transactions-on-pattern-
languages-of-programming-iv-james-noble/

Foundations of Quantum Programming 1st Edition Ying

https://textbookfull.com/product/foundations-of-quantum-
programming-1st-edition-ying/

Foundations of finance global edition John D. Martin

https://textbookfull.com/product/foundations-of-finance-global-
edition-john-d-martin/

Understanding Programming Languages 1st Edition Cliff


B. Jones

https://textbookfull.com/product/understanding-programming-
languages-1st-edition-cliff-b-jones/
Kent D. Lee

Foundations of
Programming
Languages
Second Edition

123
Kent D. Lee
Luther College
Decorah, IA
USA

ISSN 1863-7310 ISSN 2197-1781 (electronic)


Undergraduate Topics in Computer Science
ISBN 978-3-319-70789-1 ISBN 978-3-319-70790-7 (eBook)
https:\\doi.org\10.1007/978-3-319-70790-7

Library of Congress Control Number: 2017958018

1st edition: © Springer International Publishing Switzerland 2014

2nd edition: © Springer International Publishing AG 2017


Preface

A career in computer science is a commitment to a lifetime of learning. You will not


be taught every detail you will need in your career while you are a student. The goal
of a computer science education is to give you the tools you need so you can teach
yourself new languages, frameworks, and architectures as they come along. The
creativity encouraged by a lifetime of learning makes computer science one of the
most exciting fields today.
There are engineering and theoretical aspects to the field of computer science.
Theory often is a part of the development of new programming languages and tools
to make programmers more productive. Computer programming is the process of
building complex systems with those tools. Computer programmers are program
engineers, and this process is sometimes called software engineering. No matter
what kind of job you end up doing, understanding the tools of computer science,
and specifically the programming languages you use, will help you become a better
programmer.
As programmers it is important that we be able to predict what our programs will
do. Predicting what a program will do is easier if you understand the way the pro-
gramming language works. Programs execute according to a computational model.
A model may be implemented in many different ways depending on the targeted
hardware architecture. While there are currently a number of popular hardware
architectures, most can be categorized into one of two main areas: register-based
central processing units and stack-based virtual machines. While these two types of
architectures are different in some ways, they also share a number of characteristics
when used as the target for programming languages. This text develops a stack-based
virtual machine based on the Python virtual machine called JCoCo.
Computer scientists differentiate programming languages based on three paradigms
or ways of thinking about programming: object-oriented/imperative programming,
functional programming, and logic programming. This text covers these three para-
digms while using each of them in the implementation of a non-trivial programming
language.
It is expected that most readers of this text will have had some prior experience
with object-oriented languages. JCoCo is implemented in Java (hence the J), pro-
viding a chance to learn Java in some detail and see it used in a larger software
project like the JCoCo implementation. The text proceeds in a bottom-up fashion by
implementing extensions to JCoCo using Java. Then, a full-featured functional
language called Small is implemented on top of the JCoCo virtual machine. The
Small language is a subset of Standard ML. Standard ML is first introduced in this
text and then used to implement the Small subset of the Standard ML language,
which really is not that small afterall. Finally, late in the text a type inference system
for Small is developed and implemented in Prolog. Prolog is an example of a logic
programming language.
The text is meant to be used interactively. You should read a section, and as you
read it, do the practice exercises. Each of the exercises is meant to give you a goal
in reading a section of the text.
The text Web site http://www.cs.luther.edu/*leekent/PL includes code and
other support files that may be downloaded. These include the JCoCo virtual
machine and the MLComp compiler/type inference system.
I hope you enjoy reading the text and working through the exercises and practice
problems. Have fun with it and get creative!

Acknowledgements

I have been fortunate to have good teachers throughout high school, college, and
graduate school. Ken Slonneger was my advisor in graduate school, and this book
came into being because of him. He inspired me to write a text that supports the
same teaching style he used in his classroom. I’d also like to thank Eric Manley of
Drake University for working with me by trying the projects with his students and
for the valuable feedback he provided to me during the development of this text.
Thanks, Eric.
I’m also fortunate to have good students working with me. Thanks go to
Jonathan Opdahl for his help in building the Java version of CoCo, a virtual
machine used throughout this text, and named JCoCo both because it is imple-
mented in Java and because Jonathan helped me build it. Thank you Jonathan for
your work on this project. It is greatly appreciated.

For Teachers

This book was written to fulfill two goals. The first is to introduce students to three
programming paradigms: object-oriented/imperative, functional, and logic pro-
gramming. To be ready for the content of this book, students should have some
background in an imperative language, probably an object-oriented language such
as Python, Java, or C++. They should have had an introductory course and a course
in data structures as a minimum. While the prepared student will have written
several programs, some of them fairly complex, most probably still struggle with
predicting exactly what their program will do. It is assumed that ideas such as
polymorphism, recursion, and logical implication are relatively new to students
reading this book. The text assumes that students have little or no experience with
the functional and logic programming paradigms.
The object-oriented language presented in this book is Java. C++ has many
nuances that are worthy of several chapters in a textbook. The first edition of this
text did cover C++ as the object-oriented language, but Java is better suited to the
JCoCo virtual machine implementation presented in this text. However, significant
topics of C++ are contrasted to Java in this text. Notably, the pass-by-value and
pass-by-reference mechanisms in C++ create considerable complexity in the lan-
guage. In addition, the ability of C++ programs to create objects both on the
run-time stack and in the heap is contrasted to Java. Of course the standard
object-oriented concepts including polymorphism and inheritance and a comparison
of templates from C++ and interfaces from Java are covered in this text.
The text uses Standard ML as the functional language. ML has a polymorphic
type inference system to statically type programs of the language. In addition, the
type inference system of ML is formally proven sound and complete. This has some
implications in writing programs. While ML’s cryptic compiler error messages are
sometimes hard to understand at first, once a program compiles it will often work
correctly the first time. That’s an amazing statement to make if your past experience
is in a dynamically typed language such as Lisp, Scheme, Ruby, or Python.
The logic language used in this text is Prolog. While Prolog has traditionally
been an Artificial Intelligence language, it originated as a metalanguage for
expressing other languages. The text concentrates on using Prolog to implement a
type inference system. Students learn about logical implication and how a problem
they are familiar with can be re-expressed in a logic programming language.
The second goal of the text is to be interactive. This book is intended to be used
in and outside of class. It is my experience that we almost all learn more by doing
than by seeing. To that end, the text encourages teachers to actively teach. Each
chapter follows a pattern of presenting a topic followed by a practice exercise or
exercises that encourage students to try what they have just read. These exercises
can be used in class to help students check their understanding of a topic. Teachers
are encouraged to take the time to present a topic and then allow students time to
reflect and practice the concept just presented. In this way, the text becomes a
lecture resource. Students get two things out of this. It forces them to be interac-
tively engaged in the lectures, not just passive observers. It also gives them
immediate feedback on key concepts to help them determine whether they under-
stand the material or not. This encourages them to ask questions when they have
difficulty with an exercise. Tell students to bring the book to class along with a
pencil and paper. The practice exercises are easily identified.
This book presents several projects to reinforce topics outside the classroom.
Each chapter of the text suggests several non-trivial programming projects that
accompany the paradigm being covered to drive home the concepts covered in that
chapter. The projects and exercises described in this text have been tested in
practice, and documentation and solutions are available upon request.

Decorah, USA Kent D. Lee


Contents

1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Historical Perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Models of Computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.1 The Imperative Model . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2.2 The Functional Model . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2.3 The Logic Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3 The Origins of a Few Programming Languages . . . . . . . . . . . . . 10
1.3.1 A Brief History of C and C++ . . . . . . . . . . . . . . . . . . . 11
1.3.2 A Brief History of Java . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3.3 A Brief History of Python . . . . . . . . . . . . . . . . . . . . . . . 14
1.3.4 A Brief History of Standard ML . . . . . . . . . . . . . . . . . . 14
1.3.5 A Brief History of Prolog . . . . . . . . . . . . . . . . . . . . . . . 16
1.4 Language Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.4.1 Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.4.2 Interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.4.3 Virtual Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.5 Types and Type Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.6 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.7 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
1.8 Solutions to Practice Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.1 Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.2 Backus Naur Form (BNF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.2.1 BNF Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.2.2 Extended BNF (EBNF) . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.3 Context-Free Grammars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.3.1 The Infix Expression Grammar . . . . . . . . . . . . . . . . . . . 35
2.4 Derivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.4.1 A Derivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.4.2 Types of Derivations . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.4.3 Prefix Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.4.4 The Prefix Expression Grammar . . . . . . . . . . . . . . . . . . 36
2.5 Parse Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.6 Abstract Syntax Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2.7 Lexical Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.7.1 The Language of Regular Expressions . . . . . . . . . . . . . 39
2.7.2 Finite State Machines . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.7.3 Lexer Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.8 Parsing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.9 Top-Down Parsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
2.9.1 An LL(1) Grammar . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
2.9.2 A Non-LL(1) Grammar . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.9.3 An LL(1) Infix Expression Grammar . . . . . . . . . . . . . . . 45
2.10 Bottom-Up Parsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2.10.1 Parsing an Infix Expression . . . . . . . . . . . . . . . . . . . . . . 46
2.11 Ambiguity in Grammars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.12 Other Forms of Grammars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.13 Limitations of Syntactic Definitions . . . . . . . . . . . . . . . . . . . . . . 50
2.14 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.15 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.16 Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
2.17 Solutions to Practice Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3 Assembly Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.1 Overview of the JCoCo VM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3.2 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.3 Input/Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
3.4 If-Then-Else Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
3.4.1 If-Then Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.5 While Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
3.6 Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
3.7 List Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
3.8 Calling a Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
3.9 Iterating Over a List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
3.10 Range Objects and Lazy Evaluation . . . . . . . . . . . . . . . . . . . . . . 81
3.11 Functions and Closures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
3.12 Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
3.13 Support for Classes and Objects . . . . . . . . . . . . . . . . . . . . . . . . . 89
3.13.1 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
3.13.2 Dynamically Created Classes . . . . . . . . . . . . . . . . . . . . . 94
3.14 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
3.15 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
3.16 Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
3.17 Solutions to Practice Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 100
4 Object-Oriented Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
4.1 The Java Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
4.2 The C++ Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
4.2.1 The Macro Processor . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
4.2.2 The Make Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
4.3 Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
4.4 Dynamic Linking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
4.5 Defining the Main Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
4.6 I/O Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
4.7 Garbage Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
4.8 Threading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
4.9 The PyToken Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
4.9.1 The C++ PyToken Class . . . . . . . . . . . . . . . . . . . . . . . . 128
4.10 Inheritance and Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . 130
4.11 Interfaces and Adapters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
4.12 Functions as Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
4.13 Anonymous Inner Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
4.14 Type Casting and Generics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
4.15 Auto-Boxing and Unboxing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
4.16 Exception Handling in Java and C++ . . . . . . . . . . . . . . . . . . . . . 142
4.17 Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
4.18 JCoCo in Depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
4.19 The Scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
4.20 The Parser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
4.21 The Assembler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
4.22 ByteCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
4.23 JCoCo’s Class and Interface Type Hierarchy . . . . . . . . . . . . . . . 155
4.24 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
4.25 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
4.26 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
4.27 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
4.28 JCoCo Exceptions and Tracebacks . . . . . . . . . . . . . . . . . . . . . . . 163
4.29 Magic Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
4.30 Dictionaries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
4.30.1 Two New Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
4.30.2 Two New Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
4.30.3 Two New Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . 171
4.31 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
4.32 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
4.33 Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
4.34 Solutions to Practice Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 175
5 Functional Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
5.1 Imperative Versus Functional Programming . . . . . . . . . . . . . . . . 181
5.2 The Lambda Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
5.2.1 Normal Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
5.2.2 Problems with Applicative Order Reduction . . . . . . . . . 184
5.3 Getting Started with Standard ML . . . . . . . . . . . . . . . . . . . . . . . 184
5.4 Expressions, Types, Structures, and Functions . . . . . . . . . . . . . . 185
5.5 Recursive Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
5.6 Characters, Strings, and Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
5.7 Pattern Matching. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
5.8 Tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
5.9 Let Expressions and Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
5.10 Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
5.11 Parameter Passing in Standard ML . . . . . . . . . . . . . . . . . . . . . . . 200
5.12 Efficiency of Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
5.13 Tail Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
5.14 Currying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
5.15 Anonymous Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
5.16 Higher-Order Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
5.16.1 Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
5.16.2 Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
5.16.3 Reduce or Foldright . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
5.16.4 Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
5.17 Continuation Passing Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
5.18 Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
5.19 Programming with Side-effects . . . . . . . . . . . . . . . . . . . . . . . . . . 214
5.19.1 Variables in Standard ML . . . . . . . . . . . . . . . . . . . . . . . 214
5.19.2 Sequential Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
5.19.3 Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
5.20 Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
5.21 Encapsulation in ML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
5.21.1 Signatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
5.21.2 Implementing a Signature . . . . . . . . . . . . . . . . . . . . . . . 218
5.22 Type Inference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
5.23 Building a Prefix Calculator Interpreter . . . . . . . . . . . . . . . . . . . 220
5.23.1 The Prefix Calc Parser . . . . . . . . . . . . . . . . . . . . . . . . . . 222
5.23.2 The AST Evaluator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
5.23.3 Imperative Programming Observations . . . . . . . . . . . . . 224
5.24 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
5.25 Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
5.26 Solutions to Practice Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 228
6 Compiling Standard ML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
6.1 ML-lex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
6.2 The Small AST Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
6.3 Using ML-yacc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
6.4 Compiling and Running the Compiler . . . . . . . . . . . . . . . . . . . . 248
6.5 Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
6.6 Let Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
6.7 Unary Negation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
6.8 If-Then-Else Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
6.9 Short-Circuit Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
6.10 Defining Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
6.10.1 Curried Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
6.10.2 Mutually Recursive Functions . . . . . . . . . . . . . . . . . . . . 268
6.11 Reference Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
6.12 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
6.13 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
6.14 Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
6.15 Solutions to Practice Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 276
7 Logic Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
7.1 Getting Started with Prolog . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
7.2 Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
7.3 The Prolog Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
7.4 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
7.5 The Accumulator Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
7.6 Built-In Predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
7.7 Unification and Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
7.8 Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
7.9 Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
7.10 Parsing in Prolog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
7.10.1 Difference Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
7.11 Prolog Grammar Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
7.12 Building an AST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
7.13 Attribute Grammars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
7.13.1 Synthesized Versus Inherited . . . . . . . . . . . . . . . . . . . . . 298
7.14 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
7.15 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
7.16 Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
7.17 Solutions to Practice Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 301
8 Standard ML Type Inference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
8.1 Why Static Type Inference? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
8.1.1 Exception Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
8.1.2 A Bad Function Call . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
8.2 Type Inference Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
8.3 Using Prolog. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
8.4 The Type Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
8.5 Integers, Strings, and Boolean Constants . . . . . . . . . . . . . . . . . . 313
8.6 List and Tuple Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
8.7 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
8.8 Function Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
8.8.1 Instantiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
8.9 Let Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
8.10 Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
8.11 Matches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
8.12 Anonymous Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
8.13 Sequential Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
8.14 If-Then and While-Do . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
8.15 Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
8.16 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
8.17 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
8.18 Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
8.19 Solutions to Practice Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 334
9 Appendix A: The JCoCo Virtual Machine Specification . . . . . . . . . 337
9.1 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
9.2 JCoCo Magic and Attr Methods . . . . . . . . . . . . . . . . . . . . . . . . . 339
9.3 Global Built-In Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
9.4 Virtual Machine Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
9.5 Arithmetic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
9.6 Load and Store Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
9.7 List, Tuple, and Dictionary Instructions . . . . . . . . . . . . . . . . . . . 344
9.8 Stack Manipulation Instructions . . . . . . . . . . . . . . . . . . . . . . . . . 345
9.9 Conditional and Iterative Execution Instructions . . . . . . . . . . . . . 345
9.10 Function Execution Instructions . . . . . . . . . . . . . . . . . . . . . . . . . 347
9.11 Special Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
10 Appendix B: The Standard ML Basis Library . . . . . . . . . . . . . . . . . 349
10.1 The Bool Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
10.2 The Int Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
10.3 The Real Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
10.4 The Char Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
10.5 The String Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
10.6 The List Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
10.7 The Array Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
10.8 The TextIO Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Introduction
1

This text on Programming Languages is intended to introduce you to new ways of


thinking about programming. Typically, computer science students start out learning
to program in an imperative model of programming where variables are created and
updated as a program executes. There are other ways to program. As you learn to
program in these new paradigms you will begin to understand that there are different
ways of thinking about problem solving. Each paradigm is useful in some contexts.
This book is not meant to be a survey of lots of different languages. Rather, its purpose
is to introduce you to the three styles of programming languages by using them to
implement a non-trivial programming language. These three styles of programming
are:

• Imperative/Object-Oriented Programming with languages like Java, C++, Python,


and other languages you may have used before.
• Functional Programming with languages like Standard ML, Haskell, Lisp,
Scheme, and others.
• Logic Programming with Prolog.

The book provides an in-depth look at programming in assembly language, Java,


Standard ML, and Prolog. However, the programming language concepts covered
in this text apply to all languages in use today. The goal of the text is to help you
understand how to use the paradigms and models of computation these languages
represent to solve problems. The text elaborates on when these languages may be
appropriate for a problem by showing you how they can be used to implement a
programming language. Many of the problems solved while implementing a pro-
gramming language are similar to other problems in computer science. The text
elaborates on techniques for problem solving that you may be able to apply in the
future. You might be surprised by what you can do and how quickly a program can
come together given the right choice of language.
2 1 Introduction

To begin you should know something about the history of computing, particularly
as it applies to the models of computation that have been used in implementing many
of the programming languages we use today. All of what we know in Computer
Science is built on the shoulders of those who came before us. To understand where
we are, we really should know something about where we came from in terms of
Computer Science. Many great people have been involved in the development of
programming languages and to learn even a little about who these people are is
really fascinating and worthy of an entire book in itself.

1.1 Historical Perspective

Much of what we attribute to Computer Science actually came from Mathematics.


Many mathematicians are programmers that have written their programs, or proofs
in the words of Mathematics, using mathematical notation. In the mid 1800s abstract
algebra and geometry were hot topics of research among mathematicians. In the early
1800s Niels Henrik Abel, a Norwegian mathematician, was interested in solving
a problem called the quintic equation. Eventually he developed a new branch of
mathematics called Group Theory with which he was able to prove there was no
general algebraic solution to the quintic equation. Considering the proof of this
required a new branch of mathematics, much of Abel’s work involved developing
the mathematical notation or language to describe his work. Unfortunately, Abel
died of tuberculosis at twenty six years old.
Sophus Lie (pronounced Lee), pictured in Fig. 1.1, was another Norwegian math-
ematician who lived from 1842–1899 [20]. He began where Abel’s research ended
and explored the connection of Abstract Algebra and Group Theory with Geometry.
From this work he developed a set of group theories, eventually named Lie Groups.
From this discovery he found ways of solving Ordinary Differential Equations by

Fig. 1.1 Sophus Lie [21]


1.1 Historical Perspective 3

exploiting properties of symmetry within the equations [8]. One Lie group, the E8
group was too complicated to map in Lie’s time. In fact, it wasn’t until 2007 that
the structure of the E8 group could be mapped because the solution produced sixty
times more data than the human genome project [1].
While the techniques Lie and Abel discovered were hard for people to learn and
use at the time, today computer programs capable of symbolic manipulation use
Lie’s techniques to solve these and other equally complicated problems. And, the
solutions of these problems are very relevant in the world today. For example, the
work of Sophus Lie is used in the design of aircraft.
As mathematicians’ problem solving techniques became more sophisticated and
the problems they were solving became more complex, they were interested in finding
automated ways of solving these problems. Charles Babbage (1791–1871) saw the
need for a computer to do calculations that were too error-prone for humans to
perform. He designed a difference engine to compute mathematical tables when he
found that human computers weren’t very accurate [27]. However, his computer was
mechanical and couldn’t be built using engineering techniques known at that time.
In fact it wasn’t completed until 1990, but it worked just as he said it would over a
hundred years earlier.
Charles Babbage’s difference engine was an early attempt at automating a solution
to a problem, but others would follow of course. Alan Turing was a British mathe-
matician and one of the first computer scientists. He lived from 1912–1954. In 1936
he wrote a paper entitled, “On Computable Numbers, with an Application to the
Entscheidungsproblem” [23]. The Entscheidungsproblem, or decision problem, had
been proposed a decade earlier by a German mathematician named David Hilbert.
This problem asks: Can an algorithm be defined that decides if a statement given in
first order logic can be proved from a set of axioms and known truth values? The
problem was later generalized to the following question: Can we come up with a
general set of steps that given any algorithm and its data, will decide if it terminates?
In Alan Turing’s paper, he devised an abstract machine called the Turing Machine.
This Turing Machine was very general and simple. It consisted of a set of states and
a tape. The set of states were decided on by a programmer. The machine starts in
the start state as decided by the programmer. From that state it could read a symbol
from a tape. Based on the symbol it could write a symbol to the tape and move to
the left or right, while transitioning to another state. As the Turing machine ran, the
action that it took was dictated by the current state and the symbol on the tape. The
programmer got to decide how many states were a part of the machine, what each
state should do, and how to move from one state to another. In Turing’s paper he
proved that such a machine could be used to solve any computable function and that
the decision problem was not solvable by this machine. The more general statement
of this problem was named the Halting Problem. This was a very important result in
the field of theoretical Computer Science.
In 1939 John Atanasoff, at Iowa State University, designed what is arguably the
first computer, the ABC or Atanasoff-Berry Computer [28]. Clifford Berry was one of
his graduate students. The computer had no central processing unit, but it did perform
logical and other mathematical operations. Eckert and Mauchly, at the University of
4 1 Introduction

Pennsylvania, were interested in building a computer during the second world war.
They were funded by the Department of Defense to build a machine to calculate
trajectory tables for launching shells from ships. The computer, called ENIAC for
Electronic Numerical Integrator and Computer, was unveiled in 1946, just after the
war had ended. ENIAC was difficult to program since the program was written by
plugging cables into a switch, similar to an old telephone switchboard.
Around that same time a new computer, called EDVAC, was being designed. In
1945 John von Neumann proposed storing the computer programs on EDVAC in
memory along with the program data [26]. Alan Turing closely followed John von
Neumann’s paper by publishing a paper of his own in 1946 describing a more com-
plete design for stored-program computers [24]. To this day the computers we build
and use are stored-program computers. The architecture is called the von Neumann
architecture because of John von Neumann’s and Alan Turing’s contributions. While
Turing didn’t get the architecture named after him, he is famous in Computer Science
for other reasons like the Turing machine and the Halting problem.
In the early days of Computer Science, many programmers were interested in
writing tools that made it easier to program computers. Much of the programming
was based on the concept of a stored-program computer and many early programming
languages were extensions of this model of computation. In the stored-program
model the program and data are stored in memory. The program manipulates data
based on some input. It then produces output.
Around 1958, Algol was created and the second revision of this language, called
Algol 60, was the first modern, structured, imperative programming language. While
the language was designed by a committee, a large part of the success of the project
was due to the contributions of John Backus pictured in Fig. 1.2. He described the
structure of the Algol language using a mathematical notation that would later be
called Backus-Naur Format or BNF. Very little has changed with the underlying
computer architecture over the years. Of course, there have been many changes in
the size, speed, and cost of computers! In addition, the languages we use have become

Fig. 1.2 John Backus [3]


1.1 Historical Perspective 5

even more structured over the years. But, the principles that Algol 60 introduced are
still in use today.
Recalling that most early computer scientists were mathematicians, it shouldn’t
be too surprising to learn that there were others that approached the problem of
programming differently. Much of the initial interest in computers was spurred by the
invention of the stored-program computer and many of the early languages reflected
this excitement. The imperative style was closely tied to the architecture of a stored
program computer. Data was read from an input device and the program acted on
that data by updating memory as the program executed. There was another approach
developing at the same time. Back in 1936, Alonzo Church, a U.S. mathematician
who lived from 1903–1995, was also interested in the decision problem proposed
by David Hilbert. To try to solve the problem he devised a language called the
lambda calculus, usually written as the λ-calculus. Using his very simple language
he was able to describe computation as symbol manipulation. Alan Turing was a
doctoral student of Church and while they independently came up with two ways to
prove that the decision problem was not solvable, they later proved their two models
of computation, Turing machines and the λ-calculus, were equivalent. Their work
eventually led to a very important result called the Church-Turing Thesis. Informally,
the thesis states that all computable problems can be solved by a Turing Machine or
the λ-calculus. The two models are equivalent in power.
Ideas from the λ-calculus led to the development of Lisp by John McCarthy,
pictured in Fig. 1.3. The λ-calculus and Lisp were not designed based on the principle
of the stored-program computer. In contrast to Algol 60, the focus of these languages
was on functions and what could be computed using functions. Lisp was developed
around 1958, the same time that Algol 60 was being developed.
Logic is important both in Computer Science and Mathematics. Logicians were
also interested in solving problems in the early days of Computer Science. Many
problems in logic are expressed in the languages of propositional or predicate logic.

Fig. 1.3 John McCarthy [14]


6 1 Introduction

Of course, the development of logic goes all the way back to ancient Greece. Some
logicians of the 20th century were interested in understanding natural language and
they were looking for a way to use computers to solve at least some of the problems
related to processing natural language statements. The desire to use computers in
solving problems from logic led to the development of Prolog, a powerful program-
ming language based on predicate logic.

Practice 1.1 Find the answers to the following questions.

1. What are the origins of the three major computational models that early computer
scientists developed?
2. Who were Alan Turing and Alonzo Church and what were some of their contri-
butions to Computer Science?
3. What idea did both John von Neumann and Alan Turing contribute to?
4. What notation did John Backus develop and what was one of its first uses?
5. What year did Alan Turing first propose the Turing machine and why?
6. What year did Alonzo Church first propose the λ-calculus and why?
7. Why are Eckert and Mauchly famous?
8. Why are the history of Mathematics and Computer Science so closely tied
together?

You can check your answer(s) in Section 1.8.1.

1.2 Models of Computation

While there is some controversy about who originally came up with the concept of
a stored program computer, John von Neumann is generally given credit for the idea
of storing a program as a string of 0’s and 1’s in memory along with the data used by
the program. Von Neumann’s architecture had very little structure to it. It consisted
of several registers and memory. The Program Counter (PC) register kept track of
the next instruction to execute. There were other registers that could hold a value or
point to other values stored in memory. This model of computation was useful when
programs were small. However, without additional structure, anything but a small
program would quickly get hard to manage. This was what was driving the need for
better and newer programming languages. Programmers needed tools that let them
organize their code so they could focus on problem solving instead of the details of
the hardware.
1.2 Models of Computation 7

1.2.1 The Imperative Model

As programs grew in size it was necessary to provide the means for applying addi-
tional structure to them. In the early days a function was often called a sub-routine.
Functions, procedures, and sub-routines were introduced by languages like Algol
60 so that programs could be decomposed into simpler sub-programs, providing
a way for programmers to organize their code. Terms like top-down or bottom-
up design were used to describe this process of subdividing programs into simpler
sub-programs. This process of subdividing programs was often called structured
programming, referring to the decomposition of programs into simpler, more man-
ageable pieces. Most modern languages provide the means to decompose problems
into simpler subproblems. We often refer to this structured approach as the imperative
model of programming.
To implement functions and function calls in the von Neumann architecture, it
was necessary to apply some organization to the data of a program. In the imperative
model, memory is divided into regions which hold the program and the data. The
data area is further subdivided into the static or global data area, the run-time stack,
and the heap as pictured in Fig. 1.4.
In the late 1970s and 1980s people like Niklaus Wirth and Bjarne Stroustrup were
interested in developing languages that supported an additional level of organization
called Object-Oriented Programming, often abbreviated OOP. Object-oriented pro-
gramming still uses the imperative model of programming. The addition of a means
to describe classes of objects gives programmers another way of organizing their
code into functions that are related to a particular type of object.
When a program executes it uses a special register called the stack pointer (SP) to
point to the top activation record on the run-time stack. The run-time stack contains
one activation record for each function or procedure invocation that is currently
unfinished in the program. The top activation record corresponds to the current

Fig. 1.4 Imperative model


8 1 Introduction

function invocation. When a function call is made an activation record is pushed


onto the run-time stack. When a function returns, the activation record is popped by
decrementing the stack pointer to point to the previous activation record.
An activation record contains information about its associated function. The local
variables of the function are stored there. The program counter’s value before the
function call was made is stored there. This is often called the return address. Other
state information may also be stored there depending on the language and the details
of the underlying von Neumann architecture. For instance, parameters passed to the
function may also be stored there.
Static or global data refers to data and functions that are accessible globally in
the program. Global data and functions are visible throughout the program. Where
global data is stored depends on the implementation of the compiler or interpreter. It
might be part of the program code in some instances. In any case, this area is where
constants, global variables, and possibly built-in globally accessible functions are
stored.
The heap is an area for dynamic memory allocation. The word dynamic means
that it happens while the program is running. All data that is created at run-time is
located in the heap. The data in the heap has no names associated with the values
stored there. Instead, named variables called pointers or references point to the data
in the heap. In addition, data in the heap may contain pointers that point to other
data, which is also usually in the heap.
Like the original von Neumann architecture, the primary goal of the imperative
model is to get data as input, transform it via updates to memory, and then produce
output based on this imperatively changed data. The imperative model of computation
parallels the underlying von Neumann architecture and is used by many modern
languages. Some variation of this model is used by languages like Algol 60, C++,
C, Java, VB.net, Python, and many other languages.

Practice 1.2 Find the answers to the following questions.

1. What are the three divisions of data memory called?


2. When does an item in the heap get created?
3. What goes in an activation record?
4. When is an activation record created?
5. When is an activation record deleted?
6. What is the primary goal of imperative, object-oriented programming?

You can check your answer(s) in Section 1.8.2.


1.2 Models of Computation 9

1.2.2 The Functional Model

In the functional model the goal of a program is slightly different. This slight change
in the way the model works has a big influence on how you program. In the functional
model of computation the focus is on function calls. Functions and parameter passing
are the primary means of accomplishing data transformation.
Data is generally not changed in the functional model. Instead, new values are
constructed from old values. A pure functional model wouldn’t allow any updates
to existing values. However, most functional languages allow limited updates to
memory in the imperative style.
The conceptual view presented in Fig. 1.4 is similar to the view in the functional
world. However, the difference between program and data is eliminated. A function
is data like any other data element. Integers and functions are both first-class citizens
of the functional world.
The static data area is still present, but takes on a minor role in the functional model.
The run-time stack becomes more important because most work is accomplished
by calling functions. Functional languages are much more careful about how they
allow programmers to access the heap and as a result, you really aren’t aware of
the heap when programming in a functional language. Data is certainly dynamically
allocated, but once data is created on the heap it is not modified in a pure functional
model. Impure models might allow some modification of storage but this is the
influence of imperative languages creeping into the functional model as a way to
deal with performance issues. The result is that you spend less time thinking about
the underlying architecture when programming in a functional language.
Lisp, Scheme, Scala, Clojure, Elixir, Haskell, Caml, and Standard ML, which is
covered in this text, are all examples of functional languages. Functional languages
may be pure, which means they do not support variable updates like the imperative
model. Scheme is a pure functional language. Most functional languages are not
pure. Standard ML and Lisp are examples of impure functional languages. Scala is
a recent functional language that also supports object-oriented programming.

Practice 1.3 Answer the following questions.

1. What are some examples of functional languages?


2. What is the primary difference between the functional and imperative models?
3. Immutable data is data that cannot be changed once created. The presence of
immutable data simplifies the conceptual model of programming. Does the imper-
ative or functional model emphasize immutable data?

You can check your answer(s) in Section 1.8.3.


10 1 Introduction

Fig. 1.5 Logic model of computation

1.2.3 The Logic Model

The logic model of computation, pictured in Fig. 1.5, is quite different from either the
imperative or functional model. In the logic model the programmer doesn’t actually
write a program at all. Instead, the programmer provides a database of facts or rules.
From this database, a single program tries to answer questions with a yes or no
answer. In the case of Prolog, the program acts in a predictable manner allowing
the programmer to provide the facts in an order that determines how the program
will work. The actual implementation of this conceptual view is accomplished by a
virtual machine, a technique for implementing languages that is covered later in this
text.
There is still the concept of a heap in Prolog. One can assert new rules and retract
rules as the program executes. To dynamically add rules or retract them there must
be an underlying heap. In fact, the run-time stack is there too. However, the run-time
stack and heap are so hidden in this view of the world that it is debatable whether
they should appear in the conceptual model at all.

Practice 1.4 Answer these questions on what you just read.

1. How many programs can you write in a logic programming language like Prolog?
2. What does the programmer do when writing in Prolog?

You can check your answer(s) in Section 1.8.4.

1.3 The Origins of a Few Programming Languages

This book explores language implementation using several small languages and
exercises that illustrate each of these models of computation. In addition, exercises
within the text will require implementation in four different languages: assembly
1.3 The Origins of a Few Programming Languages 11

language, Java (or alternatively C++), Standard ML, and Prolog. But where did
these languages come from and why are we interested in learning how to use them?

1.3.1 A Brief History of C and C++

The Unix operating system was conceived of, designed, and written around 1972.
Ken Thompson was working on the design of Unix with Dennis Ritchie. It was their
project that encouraged Ritchie to create the C language. C was more structured than
the assembly language most operating systems were written in at the time and it was
portable and could be compiled to efficient machine code. Thompson and Ritchie
wanted an operating system that was portable, small, and well organized.
While C was efficient, there were other languages that had either been developed or
were being developed that encouraged a more structured approach to programming.
For several years there had been ideas floating around about how to write code
in object-oriented form. Simula, created by Ole-Johan Dahl and Kristen Nygaard
around 1967, was an early example of a language that supported Object-Oriented
design. Modula-2, created by Niklaus Wirth around 1978, was also taking advantage
of these ideas. Smalltalk, an interpreted language, was object-oriented and was also
developed in the mid 1970s and released in 1980.
In 1980 Bjarne Stroustrup, pictured in Fig. 1.6, began working on the design of
C++ while working at Bell Labs. He envisioned C++ as a language that would allow
C programmers to keep their old code while new code could be written using these
Object-Oriented concepts. In 1983 he named this new language C++, as in the next
increment of C, and with much anticipation, in 1985 the language was released.
About the same time Dr. Stroustrup released a book called The C++ Programming
Language [19], which described the language. The language is still evolving. For
instance, templates, an important part of C++ were first described by Stroustrup in
1988 [17] and it wasn’t until 1998 that it was standardized as ANSI C++. Today
an ANSI committee oversees the continued development of C++. The latest C++
standard was released in 2014 as of this writing. The previous standard was released

Fig. 1.6 Bjarne Stroustrup [18]


12 1 Introduction

in 2011. C++ is a mature language, but is still growing and evolving. The 2017
standard is currently in the works with comments presently being solicited by the
standards committee.

1.3.2 A Brief History of Java

C++ is a very powerful language, but also demands that programmers be very careful
when writing code. The biggest problem with C++ programs are memory leaks. When
objects are created on the heap in C++, they remain on the heap until they are freed.
If a programmer forgets to free an object, then that space cannot be re-used while the
program is running. That space is gone until the program is stopped, even if no code
has a pointer to that object anymore. This is a memory leak. And, for long-running
C++ programs it is the number one problem. Destructors are a feature of C++ that
help programmers prevent memory leaks. Depending on the structure of a class in
your program, it may need a destructor to take care of cleaning up instances of itself
(i.e. objects of the class) when they are freed.
C++ programs can create objects in the run-time stack, on the heap, or within
other objects. This is another powerful feature of C++. But, with this power over the
creation of objects comes more responsibility for the programmer. This control over
object creation leads to the need for extra code to decide how copies of objects are
made. In C++ every class may contain a copy constructor so the programmer can
control how copies of objects are made.
In 1991 a team called the Green Team, was working for a company named Sun
Microsystems. This group of software engineers wanted to design a programming
language and run-time system that could be used in the next generation of personal
devices. The group was led by a man named James Gosling. To support their vision,
they designed the Java Virtual Machine (i.e. JVM), a program that would interpret
byte code files. The JVM was designed as the run-time system for the Java program-
ming language. Java programs, when compiled, are translated into bytecode files that
run on the JVM.
The year 1995 brought the birth of the world wide web and with it one of the first
web browsers, Netscape Navigator, which later became Mozilla Firefox. In 1995 it
was announced that Netscape would include Java technology within the browser.
This led to some of the initial interest in the language, but the language has grown
way beyond web browsers. In fact, Java is not really a web browser technology
anymore. It is used in many web backends, where Java programs wait for connections
from web browsers, but it doesn’t run programs within web browsers much these
days. Another language, Javascript, is now the primary language of web browsers.
Javascript is similar to Java in name, but not its technology. Javascript was licensed
as a name from Sun Microsystems in its early days because of the popularity of
Java [22].
The original intention of Java was to serve as a means for running software for
personal devices. Java has become very important in that respect. It now is the basis
for the Android operating system that runs on many phones and other personal
devices like tablets. So, in a sense, the original goal of the Green Team has been
realized, just fifteen or so years later.
1.3 The Origins of a Few Programming Languages 13

When the original Green Team was designing Java they wanted to take the best
of C++ while leaving behind some of its complexity. In Java objects can only be
created in one location, on the heap. Sticking to one and only one memory model for
objects simplifies many aspects of Java. Objects are never copied by the language. So,
copy constructors are unnecessary in Java. When an object is passed to a function, a
reference to an object is passed without making a copy of the object. When one object
wants to contain another object, it keeps a reference to that object. Java objects are
never stored inside other objects. Simplifying the memory model for objects means
that in Java programs we don’t have to worry about copying objects.
Objects can still be copied in Java, but making copies of objects is the responsibility
of the programmer. The Java language does not make copies. Programmers make
copies by calling a special method called clone.
Java also includes garbage collection. This means that the Java Virtual Machine
takes care of deciding when the space that an object resides in can be reclaimed. It
can be reclaimed when no other objects or code have a reference to it anymore. This
means that programmers don’t have to write destructors. The JVM manages this for
them.
So, while C++ and Java share a lot of syntax, there are many differences as well.
Java has a simpler memory model. Garbage collection removes the fear of memory
leaks in Java programs. The Java Virtual Machine also provides other advantages to
writing Java programs. This does not make C++ a bad language by any means. It’s
just that Java and C++ have different goals. The JVM and Java manage a lot of the
complexity of writing object-oriented programs, freeing the programmer from these
duties. C++ on the other hand, gives you the power to manage all the details of a
program, right down to the hardware interface. Neither is better than the other, they
just serve different purposes while the two languages also share a lot of the same
syntax.

Fig. 1.7 Guido van Rossum [25]


14 1 Introduction

1.3.3 A Brief History of Python

Python was designed and implemented by Guido van Rossum, pictured in Fig. 1.7. He
started Python as a hobby project during the winter months of 1989. A more complete
history of this language is available on the web at http://python-history.blogspot.com.
Python is another object-oriented language like C++ and Java. Unlike C++, Python
is an interpreted language. Mr. van Rossum designed Python’s interpreter as a virtual
machine, like the Java Virtual Machine (i.e. JVM). But Python’s virtual machine is
not accessible separately, unlike the JVM. The Python virtual machine is an internal
implementation detail of the Python interpreter. Virtual machines have been around
for some time including an operating system for IBM mainframe computers, called
VM. Using a virtual machine when implementing a programming language can make
the language and its programs more portable across platforms. Python runs on many
different platforms like Apple’s Mac OS X, Linux, and Microsoft Windows. Virtual
machines can also provide services that make language implementation easier.
Programmers world-wide have embraced Python and have developed many
libraries for Python and written many programs. Python has gained popularity among
developers because of its portability and the ability to provide libraries to others.
Guido van Rossum states in his history of Python, “A large complex system should
have multiple levels of extensibility. This maximizes the opportunities for users,
sophisticated or not, to help themselves.” Extensibility refers to the ability to define
libraries of classes to solve problems from many different application areas. Python
is used in internet programming, server scripting, computer graphics, visualization,
Mathematics, Computer Science education, and many, many other application areas.
Mr. van Rossum continues, saying “In many ways, the design philosophy I used
when creating Python is probably one of the main reasons for its ultimate success.
Rather than striving for perfection, early adopters found that Python worked “well
enough” for their purposes. As the user-base grew, suggestions for improvement
were gradually incorporated into the language.” Growing the user-base has been
key to the success of Python. As the number of programmers that know Python
has increased so has interest in improving the language. Python now has two major
versions, Python 2 and Python 3. Python 3 is not backward compatible with Python
2. This break in compatibility gave the Python developers an opportunity to make
improvements in the language. Chapters 3 and 4 cover some of the implementation
details of the Python programming language.

1.3.4 A Brief History of Standard ML

Standard ML originated in 1986, but was the follow-on of ML which originated in


1973 [16]. Like many other languages, ML was implemented for a specific purpose.
The ML stands for Meta Language. Meta means above or about. So a metalanguage
is a language about language. In other words, a language used to describe a language.
ML was originally designed for a theorem proving system. The theorem prover was
called LCF, which stands for Logic for Computable Functions. The LCF theorem
Exploring the Variety of Random
Documents with Different Content
enson Co., ] i -: e i Prank, and two daughl.ilibie and Sarah): Absalom
married Susan Roup, of Millheim, and had six children, two David
and Alfred, and four daughters. Annie Swartz (of Lewisburg), Libby
(whose husband. Mr. Boltz, is a farmer below Aaronsburg). Kate and
Rosie; Mary married Henry Ano, of Xew Berlin. Union Co., Pa., a
coachmaker. and they have six living children. Johanna, Charlie.
Jennie, Tim, Harry and Durben : Manda died in young womanhood;
David was fifth in the family: Jeremiah died in infancy: Catherine
married Levi Caver, a farmi i S i phenson county. Til. (no children) :
Elizabeth died in infancy: Samson Q. married Rosie Bower and had
three children. Bertha. Elizabeth and Harry, of East Orange. Xew
Jersey. David Mingle, father of David Cloyd Mingle, learned the trade
of coachmaker. If his father had not died when he was so young he
would undoubt 
The text on this page is estimated to be only 22.89%
accurate

NORTHUMBERLAND COUNTY, PENNSYLVANIA 955 edly


have learned his trade, shoeinaking. In 1886 be entered the hotel
business as proprietor of the "American House" at Lancaster, Pa.,
which he conducted until 1889. From there he went to Mount Joy,
same county, where he ran the "Red Lien Hotel" for a year, after
which he was at Greencastle, Franklin county, where he conducted
the •'('row] House" for six years. He was then at Danville, Pa., for
four years, conducting the "City Hotel," after which he lived retired
at Lancaster for about two years. His next location was at Newport,
Perry- Co., Pa., where he had the "Mingle House" for a period of six
years, until his retirement. He still makes his home at that place,
now (1910) in his seventy-fifth year enjoying the fruits of his active
days in well earned leisure. In polities Mr. Mingle is a Democrat, with
independent inclinations. In January. 1863, Mr. Mingle married
Catherine Mutherbaugh, who is now over sevi years old. Nine
children were born to this union: Flora married Thomas Pendergast,
an engineer, of Lancaster, and had four children. Dolly (deceased),
Claudy (deceased), Harold (who has a daughter, Margaret), and
Mildred; Carrie. Mildred and Myrtle are unmarried ; Minnie May
married Joseph Henderson and died April 38, 1910, leaving one
daughter, Catherine; one son died in infancy: David Cloyd is
mentioned below: Sanford Bruce is a resident of Harrisburg; Jennie
Alice married Samuel Myers, and they live at Newport (they have no
children). David Cloyd Mingle received a good education in the
elementary -and high schools of Lancaster, Mount Joy and
Greencastle. He was trained to the hotel business from early youth,
assisting his father, and when he engaged in the business on his
own account took the "City Hotel" al Danville, which he conducted
for four years. He then became proprietor of the well known
"Cocalico Hotel" at Ephrata, Pa., which he .Mind on for two years,
later going to Newport, where he ran the "Mingle House" tor ike
veins. Thence he moved to Milton, Northumberland county, where
he had the "Mingle Cafe." now known as Summers Cafe, for two
years, until he bought the "Mansion House." the leading hotel of
Watsontown, in torn;. This hotel has twenty-four room-. and is a
modern structure of fine appearance, surrounded with spacious
porches and well equipped and appointed. It is well kept up and
conducted along modern lines, and Mr. Mingle has made a success
of the establishment from the beginning, his thorough understanding
of the business insuring his patrons that everything possible to
efficient management may be expected of him. He is a member of
the Hotel Protective Association and the Commercial Travelers
Association. Fraternally he is an Elk and a member of the Improved
Order of Red Men. belonging to Lodge No. 663, Lewistown. On Nov.
9, 1905, Mr. Mingle married Laura M. Cast. JOHN H. JOHXSOX.
merchant of Milton. Northumberland county, is engaged as a dealer
in iron, stoves and tinware, and has also built up an extensive
patronage in tinsmithing, roofing, spouting and sheet metal work.
Since 1903 he has also done contracting, ami as his business
interests reach out beyond Milton to surrounding towns he bids fair
to become one of the most successful men in this section of the
county, lie has made In- home in Milton from boj h 1. Mr. Johnson is
a native of Center county, Pa., born July 25, 1867, at Milesburg, and
his family is of Swedish origin, hut has Ion-- been settled in this
country. His ancestors first emigrated from Sweden to Scotland, from
which country his greatgrandfather, John Johnson, came to America,
settling in New Jersey, where he built the firs! forge along the coast.
The records show that he was an expert mechanic, and he was thus
engaged until his death. John Johnson, grandfather of .John TF. was
born in New Jersey, whence he removed in young manhood to
Center county, Pa., being oi f the pioneers in the iron business in thai
region. He svas engaged in that line of work all his life finding a
market for his iron at Pittsburg, whither he hauled it from his own
forge with mules. He died at Milesburg, Center county. His wile was
Margaret Bryson. and among their children were: Elizabeth, who
married Daniel McE and died at the advanced age of ninet; ;
George: Ella, who married Henry Eberly; Peter, wh i 1 1 eel before
Petersburg, while serving in the Civil war: and Charles, who was
killed in the Four sons and two sons-in-law oi' killed while serving in
the Civil war. John Johnson, father of John IF. was a oa of New
Jersey and very young when ho mi with his father to Center county,
I'a. lake his father he also foil e iron business nil his and nfter
coming to \l ilton, in 1882, was d in the old rolling mill. Me died in I
During the Civil war he served as a membi Co. IF of a Ph. regiment,
Volunteer lnfantry, and contracted i\ phoid fever while on duty as a
soldier, suffering from poor health i time after leaving the service.
But he eventually recovered. He married Rebecca ( Iroft, daught
John and Rebecca i Irington) Croft. Mr. and Mrs. Johnson are buried
at Milton. Five sons were born to their union: John IF. Samuel,
William. Elmer and Morris, nil residing in Milton with tl xception of
William, who lives in Chii ago, [Hinois. Jolm TL Johnson rei ei ed hi-
education in
The text on this page is estimated to be only 22.01%
accurate

956 NORTHUMBERLAND COUNTY. PENNSYLVANIA public-


schools of Milesburg and at Bellefonte Academy. He removed to
Milton with his father, and like the members of his family generally
early became interested in the iron business. Fur three years he had
charge of the nail department of the C. A. Godcharles Company's
plant, and then engaged in the scrap iron business on his own
aceount, a line in which he has continued with profit to the present
time. His main office is on South Front street, Milton, and he has
warehouses al both McEwensville and Milton. It was in natural order
that tinsmithing and similar work should come his way. and he lias
built up an extensive trsde in genera] work of that kind and in
roofing. -pouting and sheet metal work, his customers being found
all over Milton and adjacent town-. Since L903 be has also done
contracting, and he was engaged on the excavation for the Souter
Silk Company's mills at Milton. Mr. Johnson has proved his ability t"
keep up with the times and to lead progress in his chosen line of
work, which undoubtedly accounts for the success he has made. Hi-
persona] and business standing is irreproachaable. Mr. Johnson
married Florence E. Krock, daughter of John and Emma (Whitman)
Krock, and they have had one daughter. Elizabeth. He is a member
of the Lutheran Church, a Republican in politics and in fraternal
connection a Mas
The text on this page is estimated to be only 22.59%
accurate

NORTHUMBERLAND COUNTY, PENNSYLVANIA 951 the war


of 1812-15. He was with Jackson at the battle of New Orleans. Jan.
s. 1815. His army service covered over fifty years, and he died at the
ageofaboul seventy af Orwigsburg, Schuylkill Co., Pa., where he is
buried; the date of death appears on his tombstone there. Frederick
Hesser (2), recorded above as having been horn in 1763, was the
grandfather of Mr. W. Reiff Hesser. He enlisted as a drummer in
Washington's army in September, 1776, and the terms of enlistment
being frequently short in the Revolution, subsequently enlisted three
tunes. ||,. was present at and took active part in the haul.- of
Trenton and Brandywine, was in the reserve ai {Jermantown, and
saw active service at various other points. A Hessian musket given
him after the fight at Trenton is now in the possession of the family.
A British prisoner drummer taught him to drum according to army
regulations, and lie proved such an apt pupil that he was a drum
major in the service when still quite young. Removing to Schuylkill
county while it was still a part of Berks county (divided in 1811), he
remained there the resl of his life, living at Orwigsburg until his
death about 1851. He was high sheriff of thai county in 1815 and
was couri crier for several years, in those days assembling c i by roll
of the drum in the large open square where the old courthouse still
stands. He was a brother-in-law of Francis R. Shunk, who became
governor of Pennsylvania, and was himself a man of substance and
importance in his section. Frederick I lesser (2) had four sons of wl
there i- record ; it is probable there were no others. These sons
were : Frederick Hesser (3) removed to Fort Madison, [owa, where
he became a prosperous merchant: it is thought he died about 1880.
Another son, whose name we do not know, left home when young
and was never afterward heard from. Charles Hesser became a
prominent bishop in the Evangelical Church: we have not the exact
date of his death, but it seems to have occurred aboul L845-48.
Henry Hesser (father of "W. Reiff Hesser) was the youngest of the
sous of Frederick Hesser (2), who had also two daughters:
Catherine, who became Mrs. John Schoener, and Rebecca, who
became Mrs. Fraley. Both are now deceased. Mrs. Fraley was the
grandmother of Dr. Herbert Erb, of Orwigsburg. Henrv Hesser was
horn July '3. 1815, at Orwigsburg, which was then the county seal of
Schuylkill county. About 1844 he removed to Schuylkill Haven, Pa.,
and entered the service of the Philadelphia & Reading Railway
Company, in which he remained about forty-five years, holding
responsible positions to the end of his life, in 1890. His family
consisted of four sons and two daughters namely: Albert A. has for
many years been m the service of the Philadelphia & Reading Ry.
Company, for a long time as superintendent of the Mahanoy &
Shamokin Division, and still holds a position with that company:
Charles F. was a prominent business man of Cincinnati, < dim.
where he died Dec. 20, 1907; W. Reiff was for twentythree years in
the service of the Philadelphia & Reading Railway Company in
important positions, and is now in Reading, Pa., where he is serving
as probation officer; II A. was in the service of the Philadelphia &
Reading and other companies for many years before his death, in
April. L910; Elizabeth S. lives af Schuylkill Haven, l'a.: Emma R.
married H. 1'.. Zuliek and resides ai Schuylkill Haven. The exact
connection between the branch of the Hesser family to which John F.
Hesser belongs and that whose history is given above is not clearly
established, but it is certain they were of the same stock, as
Frederick Hesser, lather of John P., was a cousin or second cousin of
Henry Hesser. son of Frederick (2). The grandfather ni John F.
Hesser settled in Schuylkill county. where he died. Frederick Hesser
followed a seafaring life for -nine time. In 186] he located at Coal
Run. in Northumberland county, where he found employment at the
collieries, and for some time he was engaged as slate picker boss at
the Hickory Swamp Colliery. Hi' was murdered Dec. 10. l,s; I. in the
engine room of that colliery, by the "Molly Maeuires." Mr. Hesser was
an intelligent and respected citizen, well known in this section in his
day, having been elected coroner of the county in 1872, fur a term
of three years, lie was a Republican in politics, in religion a member
of the Evangelical Church. He married Elizabeth Swenck, a native of
Schuylkill county . and to them were born five children: Mary A . I
abeth (who died young), John F., Charles II. and George F. John F.
Hesser was hern m Is.",:; hi Schuylkill county, son of Frederick and
Elizabeth (Swenck) Hesser. He came in Northumberland county with
his father and attended the local schools until he commenced work
as a slate picker at the Coal Run colliery. When he became older he
was employed as a miner about four years, and then wen Pearson,
Lebanon ( !o., l'a.. when for two war- ai the carpenter's trade. Retun
in In- heme district lie followed his trade and assisted in the
construction of the Hickoi R breaker, having charge of pari of the
work. Cpon its completion he remained thei i breaker boss, in 1898
takin esent position af the Id k"r\ Swamp colliery. Hi lias men in bis
charge as outside foreman, and he ' their respei i and a I will to a
ratifyit Mr. Hesser is i mber of the I adependenl \" cans at Shamokin,
and he is a Republican in his political views.
The text on this page is estimated to be only 23.28%
accurate

95S NORTHUMBERLAND COUNTY, PENNSYLVANIA Mr.


Hesser married Elizabeth Moll, and they have a family of six children,
namely: Frederick E., Charles Henry, Emma P., Mary E., Albert Quay
and Laura B. HENRY CAMERON, of No. 604 West Spruce street,
Shainokin, lias lived in that borough for almost fifty years, and
throughout that long period has been employed at the mines. Fur
over twenty years he has been engaged at the Cameron mine-. Mr.
Cameron was born -May 25, 1852, in Pottsville, Schuylkill Co., Pa.,
where his father, Charles Cameron, a native of New Jersey, located
before the Civil war. His paternal grandfather had a family of six
children, those besides Charles being: Daniel, Eckhud F., John, Fliza
and Lydia A. Charles Cameron was a plasterer and bricklayer by
occupation, and followed his trade all his life. He lived for some time
at shamokin. but eventually returned to his native State, where he
died. He married Mary A. Murkel, a native of Berks county. Pa., and a
member of an old family of that county, and to them wen.' horn
seven children: Emeline i- the widow of David Reed; Mary E. married
Henry Ressler; Henry is mention, Char], - lives in Shamokin,; Simon
is a resident of Jamestown, N. Y. : Wallace lives in Rochester, Pa.: Eli
abetb married Emanuel Leiser. Henry Cameron commenced work at
the breaker when a mere hoy and has followed mining all his life. He
has been a stationary engineer during the greater part of his forty-
eight years at the mines, and commenced work with the Cameron
colliery about twenty-five years ago, Sept. 15, 1886. Hi :- now one
of the trusted employees at the Cameron mines, bearing a deserved
reputation for trustworthiness and reliability. He is a member of the
Knights of the Golden Eagle and of the 8 pherds of Bethlehem, in
politics a Republican, and iii religion an adherent of the Reformed
faith. Mr. Cameron married .Time 31, 1873, Harriet Rhoads,
daughter of Samuel and Elizabeth (Kerstetter) Rhoads, of
Northumberland county, and they have had four children: Sallie E.
died at the age of thirty years, the wife of Charles 3i elmoyer; Mary
C. died in infancy: Jennie I', is the wife of John Young, of Shamokin.
and has one child. Joseph Henry; Caroline M. died at the age of
twenty-four years. ABRAHAM C. BOYER, a young business man of
Sunbury who is engaged in the manufacture of buggies, carriages
and wagons, was born Aug. 30, 1884, in Upper Augusta township,
this county. SOD of Elias D. Boyer. The Buyers are a branch of an old
family of lower Berks county. Pa.. Wished in Northumberland county
in L831 C. great-grandfather of Abraham C. BOA I ' The emigrant
ancestor of the Bover family was John Philip Beyer, who came from
the Palatinate to Philadelphia in 1731, with a number of children. He
settled in Frederick township, Montgomery Co., Pa., but later lived in
Amity township, in the lower end of Berks county, where he ii the
spring of 1753. at a ripe old age. He belonged to the Swamp
Lutheran Church, and was buried by the pastor, Rev. Henry Melchior
Muhlenberg, who reports the matter fully in the "Halleschen
Nachrichten." His will is on record at the Philadelphia courthouse,
and in it some of his children are named. Among his sons were:
Jacob, the ancestor of the Boyertown branch of the family: and
Johann Heinrich. Johann Heinrich Boyer was born in 1714, in the
Pfalz, » terman - . and died May 2, 1814, in the one hundredth year
of his age. In 1743 be was married to Magdalena Kirchner, and
anion." his children— six -"in and one daughter — were Philip and
Heinrich. Philip Boyer, horn Dei .11. 1754, died July 31, L832; His
wife, Christiana, who was horn in 1754, also died in 1832, and both
were buried in tl Id graveyard at Amityville. Philip Boyer a will the
year before his death, while a resident of Amity township, and in it
he mentions the following children: Michael ; Jacob, who had a son
Philip: John: Peter: Mary, married to George Koch; and Daniel, born
in 1792, who died in 1825. Peter Boyer, son of Philip, was horn in
Amity township, Berks county, and in 1831 came to Northumberland
county with his wife and family. which then consisted of twelve
children, the youngest two having been born in Lower Mahanoy
township, where they settled. His 170-acre farm in that township is
now owned by one Frank Phillips. Later he moved to Dauphin
county, where he owned a valuable farm and mill property for which
he paid SlS.non. and he died in that county about 1850-51, at the
age of sixty-five years. He is buried at Hoffman's Church, in Lykens
township. Dauphin county. Though a stonemason by trade, he was
engaged principally in farming, in which he was very successful and
prosperous. He was a strong man. noted for his ageous disposition,
and was known locally as ■•YVainina-" Boyer. His wife, Catharine
Herb, also of Berks county, lived to the age of eightyfour. They were
the parents of fourteen children, as follows: Benjamin. Sally. Elias.
Isaac. Rachel. Mary, Hettie, Gabriel, Abraham. Catharine. Josiah and
Benneville (twins). John and Leah, the two last named born in
Northumberland county. John Boyer. probably an uncle of Peter
Boyer. above, served as a soldier in the Revolutionary war. Abraham
Boyer. son of Peter, was born in Amity township. Berks county, and
came with the family to Lower Mahanoy township, where he passed
the
The text on this page is estimated to be only 20.96%
accurate

NORTHUMBERLAND COUNTY, PENNSYLVAN1 \ '.l.V.l


remainder of his active and successful life with ill'- exception of the
.wars he was at Millerstown, Perry County. Like the Boyers generally,
he was noted for his industry ami thrift, ami he became "in' "I' the
most extensive fanners in Lower Mahanoy township, owning about
five hundred acres of land, lie died in Lower Mahanoy township.
Abraham Boyer married Catharine Anderson, daughter of John
Anderson, ami in them were horn si\ children, namely: S. Pierce;
Amelia, who married Henry Kieffer, of Dauphin county, Pa.: John,
deceased ; Elias D. ; Hannah, married to John Lahr, of Pillow, Pa.:
ami Peter, of Pillow. Elias I ». Boyer, son of Abraham, was bora April
in. 1857, in Lower Mahano} township, ami was there reared in
farming, in which he has continued lo he interested up to the
present time. After living in Stone Valley, in Lower Mahanoy, for five
years, he moved in 1882 to Upper Augusta township, where be has
since made his borne. He is extensively engaged in genera] farming,
owning a number of farms — two in Upper Augusta township, one of
L68 acres ami one of seventeen acres; ami three in Lower Augusta
township, of sixty-one acres, eighty-nine acres and 105 acre?.
respectively. As a lumber dealer lie has interests all over (he county,
employing from six to twenty men in this line, as business demands.
Mr. Lover has also engaged in contracting, having put up ahoiii forty
houses in the borough of Sunbury, where he has invested heavilv in
real estate. The farm in Upper Augusta township upon which he
makes his home is an attractive and valuable property, with a
valuable farm stock ami well equipped throughout. A g 1 manager,
ami possessing excellent judgment in business matters. Mr. Boyer
has been very successful, ami by his own efforts lias accumulated
considerable property. In 187S Mr. Boyer married Catharine Peifer,
daughter of Isaac and Eve (Yerger) Peifer, who lived in Jackson
township, and nine children have been horn In them : William, now
of Fisher's Perry, Pa.: John, who died in infancy: Hannah, married io
i, onion Neidig, of Lower Augusta township, this county: Abraham C.
: Eve. who died in infancy; Amelia M.. who died in infancy: Edward
C. ; Katie; and Emma A". Mr. Boyer and his family attend the
Hollowing Pun Union Church. of which be is a Reformed and his wife
a Lutheran member. In political conviction he is a Democrat.
Abraham C. Boyer received a public -'-1 1 education, in September,
1906, ho came to Sunbury and established his present business,
having a factory on the corner of Woodlawn avenue and Gas Alley
for the manufacture of buggies, carriages and wagons, and facilities
for all kinds of repairing, of which he makes a specialty. He also acts
as agent for Swab's wagons. Mr. Boyer lias gained a lucrative
patronage, and gives employment io four men. lie is one of the
enterprising young business men of the borough and has high
standing among his associates ami all with whom he has dealings.
On Dec -.M. 1905, Mr. Lover married Josephine Drumm, daughter of
John Drumm, ami the} have three children. Helen ('.. Mary A. ami
Elias D. lie and his family are members of the Reformed Church, and
fraternally he belongs to the Modern Woodmen of America. JACOB
S. ROHRBACH of Shamokin township, at present engaged at the
carpenter's trade, was bora April -I. L850, in Locust township,
Columbia Co.. Pa., son of David Rohrbach and grandson of Jacob
Rohrbach. The Rohrbach family i- an old one in Pennsylvania, of
German origin, being descended from John George Rohrbach, who
emigrated to America about tin1 middle of the eighteenth century.
He settled in Eastern Pennsylvania, in Berks county, in the territory
now embraced in District township, and the family is now quite
numerous in the eastern end of that county. The ancestral
homestead is still owned by one of his descendants. He was twice
married, and by his first union had a son Lawrence, who had live
sons. Daniel. Geo ( who had eight children i . ( Ihristopher (or
Stophel, who had eleven children). Jacob and Henry. By his second
wife. Christiana Moser. he had five children, George, John, Simon,
Eva and Christiana. Those of the name now living in Berks county
are descendants of Lawrence and John: Simon is said to have moved
to Catawissa. Columa county; George to have mine West; Eva
married Jacob Finkhohner. who after her death married her sister
Christiana. The ancestor of a number of the name nowliving in
Northumberland county devoted himself to his business affairs and
was a successful and influential man of his day in the section of
Pennsylvania referred to. where he lived ami died. for many years he
conducted a charcoal furnace in conjunction with farming. He had no
aspirations toward public honors and took no part in anything
outside of his private interests. Ho married Catharine Fenstermacher,
ami to them was born a large family. Their -on George, horn in 1808
in Columbia county, Pa., was the father of the late Lloyd T. ami
William II. Rohrbach, both prominent citizens of Sunbury. David
Rohrbach, -on of Jacob Rohrbach and father of Jacob s. Rohrbach,
was born in 1 1 link- Co.. Pa., and moved with his parents to
Columbia county. He followed farming, owning inn acre- alone the
Roaring creel . where he spenl the rest of his days, dying in 1867, at
thi forty-six years. His wife. Sarah (Shuman), died in Catawissa and
i- buried there. They had children as follows: Jacob S. : .Line. Mr-. \\
il
The text on this page is estimated to be only 22.51%
accurate

960 NORTHUMBERLAND COUNTY, PENNSYLVANIA


Beckendorf; Albert, living in Sunbury : Sarah. Mrs. William
Witengruver, living in Oklahoma; Clara S.. Mrs. Lafountan, living in
Seranton, Pa.: Kenbcn. who died in Shamokin : William, living at
Newport News: and Annie, who died young. Jacob S. Rohrbaeh
learned the trade of carpenter with Christ Hartley, at Roaring Creek,
Columbia county, and followed it for four years at that time. He then
became a fireman on the railroad, where he eventually became an
engineer, on the Catawissa line, continuing in this work about four
years. Locating in Snydertown, Northumberland county, he was
employed at his trade four years, at the end of which time he
located upon the farm in Shamokin township which he still owns, the
old Muench homestead, a valuable tract of 170 acres. For the next
twenty-two years he was engaged in farming, from which he retired
a few years ago to resume his trade, at which he is now engaged.
His farm is fertile and productive land, and he has rented it since he
took up carpentry again. Mr. Rohrbaeh has been successful in the
management of his own affair- to such an extent that he has been
called upon to assist in the administration of public matters, and he
has served Ids township two years as treasurer and ten year.- as
school director. He is a Democrat in politics. On Dec 23, 1875, Mr.
Rohrbacb married Mary E. Muench, who was horn Oct. C>. 1856,
daughter of Jacob E. Muench and granddaughter of William H.
Muench. She died July 12, 1004. and is buried at St. Jacob's (Reed's)
Church. Two children were horn to lids union: (1) Edward M., horn
Nov. 28, 1883, who learned the telegrapher's art and has been
station agent at Paxinos since L908; he married Susan B. Persing
and they have had three children, Virginia Estella (died in infancy),
Clyde Edward (died in infancy), and Emanuel P. (2) Mary M. is at
home. The family are members of the Lutheran Church. The
emigrant ancestor of the Muench family was Charles E. Muench, a
descendant of a French noble family of the name of Beauvoir. He
probably crossed the French line into Germany prior to the French
Revolution, and took the oa his patrimonial estate. "Munehhofen."
He was born Jan. 7, 1769, at Mellenheim, on (lie Rhine, and was
educated at Heidelberg, where be spent. fourteen years preparing
for the ministry, learning the different languages. He inherited a
large fortune and a landed estate. Marshal Jourdan, under orders of
the French Directory (then the ruling power in France), invaded that
section, and Charles E. Muench, in defense of his country, raised a
company of dragoons. In an engagement with the French his left
arm was so terribly injured that it became partly useless. His portion
of Germany being overrun, and in the possession of tlie French
troops, he gathered together his personal property, abandoned his
landed estate and sailed for America. The \essel on which he sailed
was overtaken by a French privateer and the passengers robbed of
all their valuables, so that he landed at Philadelphia penniless. His
wife. Margaret (Bieser), and eldest daughter were with him. Unable
to obtain employment. -Jie drifted to Shaefferstown, Lebanon Co..
Pa., and subsequently lived at different points in Pennsylvania,
eventually locating in Lykens Valley, near Berrysburg, in Dauphin
county. Pa., where Mr. Muench engaged in school teaching. He died
at Lykens Valley in 1833, and his wife passeil away in 1834, both
reaching the age of sixty-four years. Their family consisted of seven
children: Juliana, born in Germany, who married Jacob Wolf: William
Henry; Charles F. : Susan. Mrs. Jacob Reigle; Jacob I'.: Daniel A., of
Harrisburg; and Margaret, Mrs. Peter Miller. William Henry Muench.
eldesl -on of Charles F. Muench, was born Feb, 10, CM. at
Shaefferstown, Lebanon Go., Pa., ami as he was bom a cripple his
parents gave him as good an education as possible, their lack of
means making it necessary to limit him to instruction in English and
German. In 1819 Rev. J. V. Shindel proposed that hi- come to the
Shamokin valley to teach those branches, and he located at Reed's
station, where 1m taught for twenty-four years, at the same place.
He became widely acquainted and was an early friend of Gen. Simon
Cameron. He served as county commissioner and held all the
township offices, ami was appointed justice of the peace for
Shamokin township by Governor Schultze, which position he tilled
thirty years, during which time lie married eighty-nine couples,
becoming known as the "marrying squire." Shamokin township at "in
lime had a much wider area than at present. including what are now
Shamokin. Ralpho, Zerbe, Coal. Mount Carmel and Cameron
townships, so that be became well known over a large territory, and
being an expert and elegant penman, an accomplishment none too
common in those days, he was often called upon to make out deeds
and i 'tgages, transacting a large amount of business of that kind.
He died Sept. 8, 1885, aged eighty-six years, and his wife Elizabeth I
Reed), daughter of Jacob Reed, whom he married in L820, died in
1866, aged sixtv-six. They are buried at St. Jacob's (Reed's) Church.
William II. Muench was an elder and leading supporter of the
German Reformed Church. He had two children. Margaret and Jacob
E. Jacob E. Muench, son of William Henry Muench. was horn at the
old homestead Sept. 20 or 29, L823, and died in 1900. During his
young manhood he taught in the township schools for a number of
years, hut bis principal occupation was fanning, which he carried on
extensively. In bis early life be was prominently connected with
The text on this page is estimated to be only 22.98%
accurate

NORTHUMBERLAND COUNTY, PENNSYLVANIA :m;i the


Stale militia, of which he was a member fourteen years. He was
appointed first lieutenanl by Governor Johnston, and was
subsequently eli 1 major, and in 1853 was appointed brigadier-
general by Governor Bigler. TTe was a Republican and active in
politics, serving several terms as auditor of his township, from 1873
to 1875 as auditor of Northumberland county, and for many years as
school director, being secretary of the township school board for
eighteen consecutive years. The public schools always had a warm
friend in this public-spirited citizen. In L886 lie was elected justice of
the peace. He was a member of the German Reformed Church, and
served as elder Sve years. On Dec. 3, 1854, Mr. Muench married
Lavina Scholl, who was horn in 1825 at Fleetw 1. Berks Co., Pa., and
met her husband at the home of Conrad Yost, who lived in Shamokin
township, this county, while on a visit. Mrs. Muench died Sept. I.
L862, aged thirty-seven years, the mother of thr children: Mary E.,
deceased, who was the wife of Jacob S. Rohrbach; William P., who
died aged seventeen years; and Emma E., who married Reuben P.
Martz, of Shamokin township, and died Jan. 7, 1902, aged forty-two
years. On \'o\. 28, 1878, Mr. Muench married (second) llatlie S.
Cooper, daughter of John Cooper, of Upper Augusta township. She is
now living at Snydertown, Pennsyh ania. JOSIAH R. RISHEL, station
agent at Turbutville and merchant at thai place, is an enterprising
young business man of his community and in the several years of his
residence there has be i ie of its respected citizens, lie was horn
Sept. 29, 1883, at Danville. Montour Co., Pa., son of Peter A. Rishel,
and is a descendant <
The text on this page is estimated to be only 22.64%
accurate

962 NORTHUMBERLAND COUNTY. PENNSYLVANIA Art; ["ST


C, HERR, of Shamokin, inside foreman at the Cameron colliery, has
held that res sible position since 1899, and he lias been identified
with the local coal held since 1S73. Be is one of the best known
miners in the region. Mr. Herr was born May 5, 1855, at a place
about three minutes' walk from Lehe, near Bremen. Gi rmar - ■ i of
Louis and Sophia (Willis) Eerr, and grandson of Nicholas Herr, who
was a miner in Germany, where he lived and died. Louis Herr passed
all his life in Germany, dying in 1866, at the age of forty-five years.
His children were: Johanna (who lives in German)'), 1. I and Augusl
< '. August C. Herr attended school in Germany until lie reached the
age of thirteen year-. Be then wont to sea on a vessel of the North
German Lloyd line, remaining with the company until 1870. Be was
in England when the war between Germany and France was
declared, and from thai country he took passage for America,
landing at Hoboken, N. J., having secured leave of absence from the
ship on which he was employed, with the understanding that he
would go back as - i as the ship returned. Bowever, he did not. di so,
going to St. Marys, Elk Co., Pa., whei found work in the soft coal
mines, remaining there until his removal to Shamokin.
Northumberland Co., Pa., in March, 1873. Here he first obtained
work at the Luke Fidler colliery, as miner, for a period of about three
months, after which he became a miner at the Cameron colliery.
Fifteen years of faithful service brought him promotion to the
position of assistant foreman, and he served as such five years, thus
rounding a term of twenty-six years in the employ of the Mineral
Railroad & Mining Company. In 1893 he became inside foreman at
the Luke Fidler colliery, but after six years in that position lie
returned to the Cameron colliery, in 1899, as inside foreman, and
there he lias since been engaged. Some idea of the extent of his
responsibilities may be gained from the mere statement that he has
eight hundred men under his direction. Mr. Herr is a man of
substantial worth and keen intelligence, a good judge of men and
their capabilities and a trustworthy person whose value in his
present incumbency has been proved in long years of service. Mr.
Herr is widely known in the fraternities, being a member of
Shamokin Lodge, No. 664, I. (). 0. F., of which he i- a past grand,
and of the Encampment; of the F. 0. K. : of Shamokin Lodge, No.
55.-,. F. & A. M., of which is ;i pasl master; of Shamokin Chapter. No.
1!. A. M. : of Shamokin Commanderv. No. 77, K. T. : and of Rajah
Temple, A. A. 0. X. M. S.. of Reading. He is a director id" the Home
Union ami of the Citizens Building and Loan Association, and is
serving as vice president of the Cuion ( 'oinpany. In 1875 Mr. Herr
married Minerva Bilbrand, whose parents were lost at sea on the
voyage from tlie old country to the United States. Children as follows
have been born to this union: rles Augustus, born Aug. 10, 1875,
who marMary E. Kerstetter and live- in Shamokin; .Minnie, born April
19, 1877, who died when five days old: Clara Wilhelinina. born April
21, 1879, who is the wife of Harvey C. Kerstetter; Lndwig C. born
June 16, 1880, who married Lillian Llewellyn; William, born Oct. 26,
1882, who married Clara .Miller: Ida. bom Dec. 21, 1884, who died -
it. 5, 1908; Franklin Monroe, born July 30, IS81; : John Alfred, bom
Sept. 15, 1889; Edward Benjamin, born March 22. 1892; and Annie,
born Oct. S, 1895. C. E. RAUP, formerly of Milton, Northumberland
county, is now located at Calf. Ontario, as manager of the Canadian
branch of Samuel J. Shinier ,\ Sons, of Milton. Pennsylvania. WALTEE
J. LEONARD, of Sunbury, engaged as yardmaster with the
Pennsylvania Railroad Company, is a native of that place, horn Feb.
21, 1876, --H of George S. Leonard. The Leonard family is of
German origin, his great-grandfather, gi Leonard, having been horn
in Germany. whence he came to America over a century ago. He
located at what is now the borough of North umberland, in
Northumberland county, La-, later going to Liverpool, Perry county,
this state. where he died at the age of eighty-seven years. He is
buried there. He was a land owner, and at one time conducted a
hotel at Northumberland Ugh. He served as a soldier during the war
of 1812. His children were: Lewi-, who died at Liverpool; John;
Susan, who married David Deckert and lived at Mount Patrick. Perry
Co., Pa.: and Polly. Mrs. Slear. John Leonard, son of George, was the
grandfather of Walter J. Leonard, of Sunbury. He was horn in
Northumberland borough, and died Nov. ?■?. 1894, at Shamokin
Dam. Snyder county, at thi' age of seventy-six years. He i- buried
there. In his earlier manhood Mr. Leonard was a merchant at
Centerville, Snyder county, for several years, and he was engaged as
a pilot on the Susquehanna river for sime time. He married Sarah
Sampsel, a native of Centerville. Su\ der county, and their children
were: George S. : Thomas M., who lives in Shamokin.
Northumberland county; and Alice, wife of Newton Hartman, living
at Shamokin Dam. George S. Leonard, son of John, was born Feb.
14. 1845, in Liverpool, Perry Co.. Pa., where he lived until he was
thirteen years old. meantime
The text on this page is estimated to be only 20.61%
accurate

NORTHUMBERLAND COUNTY, PENNSYLVANIA 963


attending the public schools. Removing i miles above Liverpool, he
was employed for the " years tending locks upon the Pennsylvania
canal, except for the time he was in service in the Union army. In
June. 1863, he enlisted from Barrisburg, bee ing a member of
Company I, 208th Regiment, Pennsylvania Volunteers, 9th Corps,
and was out aboul two years, his command being attached to the
Army of the Potomac. He was never wounded. In 1SGG he located
at Shamokin Dam. Snyder county, where he continued to work for
the .anal company until 1870, -||" i which year he has made his
home ai Sunbury. For thirty years after settling there he was in thi
employ of ihr Pennsylvania Eailroad Company (at the ti he entered
the service it was as an employ* I' the Northern Central Railway
Company), retiring in 1900. He married Mary Lower, daughter of
Michael Lower, ami they have had four children: Edward (living at
Sunbury, Pa.), Delia, Minnie (win. died aged twenty-four years) and
Walter J. Walter J. Leonard obtained his education in the public
schools of Sunbury, graduating from the high school in 1898. He
commenced railroading tin' same year, starting as a messenger, and
was promoted from time to time until in 1900 he became master of
the freight yard at Sunbury, where he has i barge of fifty men. Mr.
Leonard has won his promotions on merit, having made a record for
trustworthiness and capability by a consistent career of faithful and
reliable service. Mil Nov. 25, 1896, Mr. Leonard married Clara Day,
daughter of Noah Lay. and to them have been born five children,
two of whom died in infancy; the survivors are Dorothy Ruth, J.
Edward and Sidney. Mr. Leonard lias a home of his own ai No. 126
South Fourth street. He and his family attend the Methodist Church,
and socially lie is identified with several organizations, holding
membership in True Cross Commandery, No. 11"-.'. Knights of Malta,
Lodge No. 416, Knights of Pythias, Lodge Xo. 267, I',. I'. 0. Elks, the
Y. M. ('. A. and No. 1 Lire Company, all of Sunbury. In politics he is a
Republican. Jackson Day, grandfather of Mrs. Walter J. Leonard, was
a native of York county, La. For a number of years he lived at
Millersburg, Dauphin Co.. Pa., where he conducted the work train,
and he died at the age of sixty-five, in about 1891, at thai place,
where he is buried. He was a member of the United Evangelical
Church. He and his wife Jane (Beck), who was also of York county,
had a family of eight children. Noah Day, son of Jackson, and Jane (
Reck i Day. was born Mav 1. 1851, at Shrewsbury, York Co.. La.,
where he received his education. He began railroading at the early
age of fi ^ears on the Pennsylvania Railroad Company's work train ai
Millersburg, and after serving as flagman and fireman in turn
became engineer. being engaged in that capacity for thirty years re
In- death. He was van! engineer at. DY. Mr. Day was well known
among railroad men. was a member of the Brotherh 1 of Locomotive
Engineers and Firemen, of the Pennsylvania Relief Fund Association
and of the Veteran's Association. He held membership in the Firs!
United Evangelical Church at Sunbury. and in polities was a stanch
Republican. Mr. Day's firsl marriage was to Alda Gilbert, who is
buried at Millersburg. By that union he had two children: Frederick,
who lives ai Stone Harbor, X. J.; and Jennie, who married Samuel
Kobe! and lives at Millersburg, Pa. On Oct. 12, L876, Mr. Day married
(second) Margaret Yeager, daughter of christian Yeager, a native of
Germany, who lived at Georgetown (Dalmatia), Pa. Mr. Yeager
married Sarah Burrell, who was from Lower Mahanoy township, this
county, and they had children: George, Alexander, Sarah. I' and
Margaret (wife of Noah Lay). Six children were horn to Mr. and Mr-.
Day: (Mara, Mr-. Walter J. Leonard; Cora M.. wife of Jonathan K
nuked . of Sunbury; Jackson, who died in infancy: Virgie V.. wife of
Ralph Bailey, of Williamsport, La.: Daisy, who died in infancy, and
Yerlin E., wife of Charles B. Smith, a railroader. who has a daughter.
Geraldine Elizabeth (they reside with Mrs. Day ). PATRICK F.
KEARINS, of shamokin. proprietor of the "Market Street Hotel." ha-
succeeded his father ill the business. The la! letwas one of the early
hotel-keepers of the borough, and in his day was a well known man
and regarded a- one of the public-spirited citizens of Shamokin.
Patrick Kearins, the father, was born in 1s:!3 in Ireland, and wa- a
young man when he came to America. lie located at Shamokin
anion"' the early residents of the place, and for some followed
mining, later engaging in the hotel business, which he continued
until his death. He took a great interest in the welfare of In- adopted
town, and was respected b} the many with whom he came in
contact in his business an. I social relations. He died in ls'.is. ai the
age of sixtyfour years, and is buried at Shamokin. lie wa ml "i- of Si.
Edward's Catholic Church. Mr. Kearins married Bridget Kelly, who
died when still a young woman, the mother of five children: Mary,
who married Joseph Simmons ; Kane. married Peter Leibig: Thomas,
who died h seventeen years old: John, who is living with his brother
Patrick : and Lai rick L. Patrick F. Kearins was born al Shamokin dan.
is. 1871, and received his education there in the public and parochial
schools. Lor about two ho w;i< employed ai the mines, and lion
The text on this page is estimated to be only 21.24%
accurate

964 NORTHUMBERLAND COUNTY. PENNSYLVANIA learned


the printer's trade, at which he was engaged for about seven years
in all, until he became associated in (lie hotel business with his
father, about two years before the hitter's death. After that event lie
continued the business on his own account, buying the property in
1903. The location, at Nos. 22-24 North Market street, is a favorable
one for hotel purposes, and Mr. Kearins has held the trade which his
father established and increased it by his own good management.
He has a wide acquaintanceship and is a substantial and respected
man. In April, 1902, Mi-. Kearins married Margaret Jones, daughter
of Herbert M. Jones, the latter a native of Wales who came to
America and settled in Shamokin. Air. and Mrs. Kearins have had the
following children : Mary. .Marguerite (deceased), Patrick and John
(the latter deceased). Mr. Kearins is a member of St. Edward's
Catholic ( liurch and a member of the Foresters, the Ancient Order of
Hibernians, and the Red Men. He is an independent voter, supporting
the lust man, regardless of parl\ . EZRA R. JACOBY, of
Northumberland, now serving as assistant yardmaster for the
Pennsylvania Railway Company at that point, has been in the employ
of that company continuously for the long period of forty-three
years, and for over a quarter of a century held the responsible
position of general yardmaster. Mr. Jacoby is of German descent, his
great-grandfather having been one of the five Jacoby brothers who
carne from Wurtemberg, Germany, to this country, one settling in
Philadelphia, on what is now jacoby street, so named in his honor :
he conducted what was known as the "Black Horse Hotel." One
settled at Valley Forge, ami participated in the Revolutionary war.
Another settled on Durham creek, in Bucks county. Pa., and during
the war sold his wheat to the Colonial Government, being paid in
Continental money, some of which is still treasured by members of
the family, Mr. Ezra R. Jacoby. of Northumberland, having part of it.
The fourth brother settled near Allentown, Pa., and the fifth in Bucks
county, at Bursonville. The last mentioned had a son John Jacoby,
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like