文档介绍:Essentials of Programming Languages
second edition
This page intentionally left blank.
Essentials of Programming Languages
second edition
Daniel P. FriedmanMitchell WandChristopher T. Haynes
© 2001 Massachusetts Institute of TechnologyAll rights reserved. No part of this book may be reproduced in any form by any electronic or
mechanical means (including photocopying, recording, or information storage and retrieval) without permission in writing from the publisher.
Typeset by the authors using .Printed and bound in the United States of America.
Library of Congress Cataloging-in-
Publication Information DataFriedman, Daniel P. Essentials of programming languages / Daniel P. Friedman, Mitchell Wand, Christopher T. Haynes
—2nd ed. p. cm. Includes bibliographical references and index. ISBN 0-262-06217-
8 (hc. : alk. paper) 1. Programming Languages (puters). I. Wand, Mitchell. II. Haynes, Christopher Thomas. III. .
F73 —dc21 00-135246
Contents
Foreword vii
Preface xi
Acknowledgments xvii
1 Inductive Sets of Data 1
Recursively Specified Data 1
Recursively Specified Programs 9
Scoping and Binding of Variables 28
2 Data Abstraction 39
Specifying Data via Interfaces 39
An Abstraction for Inductive Data Types 42
Representation Strategies for Data Types 55
A Queue Abstraction 66
3 Environment-Passing Interpreters 69
A Simple Interpreter 71
The Front End 75
Conditional Evaluation 80
Local Binding 81
Procedures 84
Recursion 92
Variable Assignment 98
Parameter-Passing Variations 107
Statements 120
4 Types 125
Typed Languages 125
Type Checking 132
Enforcing Abstraction Boundaries 143
Type Inference 152
5 Objects and Classes 169
Object-Oriented Programming 171
Inheritance 173
The Language 179
Four implementations 183
6 Objects and Types 205
A Simple Typed Object-Oriented Language 205
The Type Checker 211
6.