Todavía nada aún

PROGRAMMING LANGUAGE DESIGN CONCEPTS

PROGRAMMING LANGUAGE DESIGN CONCEPTS
David A. Watt, University of Glasgow
with contributions by

William Findlay, University of Glasgow

Copyright ? 2004

John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex PO19 8SQ, England Telephone (+44) 1243 779777

Email (for orders and customer service enquiries):[email protected] Visit our Home Page on www.wileyeurope.com or www.wiley.com All Rights Reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except under the terms of the Copyright, Designs and Patents Act 1988 or under the terms of a licence issued by theCopyright Licensing Agency Ltd, 90 Tottenham Court Road, London W1T 4LP, UK, without the permission in writing of the Publisher, with the exception of any material supplied speci?cally for the purpose of being entered and executed on a computer system for exclusive use by the purchase of the publication. Requests to the Publisher should be addressed to the Permissions Department, John Wiley & Sons Ltd,The Atrium, Southern Gate, Chichester, West Sussex PO19 8SQ, England, or emailed to [email protected], or faxed to (+44) 1243 770620. This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold on the understanding that the Publisher is not engaged in rendering professional services. If professional advice or other expertassistance is required, the services of a competent professional should be sought.
ADA is a registered trademark of the US Government Ada Joint Program Of?ce. JAVA is a registered trademark of Sun Microsystems Inc. OCCAM is a registered trademark of the INMOS Group of Companies. UNIX is a registered trademark of AT&T Bell Laboratories.

Other Wiley Editorial Of?ces John Wiley & Sons Inc., 111 RiverStreet, Hoboken, NJ 07030, USA Jossey-Bass, 989 Market Street, San Francisco, CA 94103-1741, USA Wiley-VCH Verlag GmbH, Boschstr. 12, D-69469 Weinheim, Germany John Wiley & Sons Australia Ltd, 33 Park Road, Milton, Queensland 4064, Australia John Wiley & Sons (Asia) Pte Ltd, 2 Clementi Loop #02-01, Jin Xing Distripark, Singapore 129809 John Wiley & Sons Canada Ltd, 22 Worcester Road, Etobicoke,Ontario, Canada M9W 1L1 Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Library of Congress Cataloging-in-Publication Data Watt, David A. (David Anthony) Programming language design concepts / David A. Watt ; with contributions by William Findlay. p. cm. Includes bibliographical references and index. ISBN0-470-85320-4 (pbk. : alk. paper) 1. Programming languages (Electronic computers) I. Findlay, William, 1947- II. Title. QA76.7 .W388 2004 005.13 – dc22 2003026236 British Library Cataloguing in Publication Data A catalogue record for this book is available from the British Library ISBN 0-470-85320-4 Typeset in 10/12pt TimesTen by Laserwords Private Limited, Chennai, India Printed and bound inGreat Britain by Biddles Ltd, King’s Lynn This book is printed on acid-free paper responsibly manufactured from sustainable forestry in which at least two trees are planted for each one used for paper production.

To Carol

Contents

Preface

xv

Part I: Introduction
1 Programming languages 1.1 Programming linguistics 1.1.1 Concepts and paradigms 1.1.2 Syntax, semantics, and pragmatics1.1.3 Language processors 1.2 Historical development Summary Further reading Exercises

1
3 3 3 5 6 6 10 10 10

Part II: Basic Concepts
2 Values and types 2.1 Types 2.2 Primitive types 2.2.1 Built-in primitive types 2.2.2 De?ned primitive types 2.2.3 Discrete primitive types 2.3 Composite types 2.3.1 Cartesian products, structures, and records 2.3.2 Mappings, arrays, and functions 2.3.3…