Cuestionario introduccion a la computacion
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): cs-books@wiley.co.uk 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 …ver más…
ecursive types in general 2.5 Type systems 2.5.1 Static vs dynamic typing 2.5.2 Type equivalence 2.5.3 The Type Completeness Principle 2.6 Expressions 2.6.1 Literals 2.6.2 Constructions 2.6.3 Function calls 2.6.4 Conditional expressions 2.6.5 Iterative expressions 2.6.6 Constant and variable accesses
13
15 15 16 16 18 19 20 21 23 27 33 33 35 36 37 38 40 42 43 43 44 46 47 48 49 vii viii
Contents
2.7
Implementation notes 2.7.1 Representation of primitive types 2.7.2 Representation of Cartesian products 2.7.3 Representation of arrays 2.7.4 Representation of disjoint unions 2.7.5 Representation of recursive types Summary Further reading Exercises 3 Variables and storage 3.1 Variables and storage 3.2 Simple variables 3.3 Composite variables 3.3.1 Total vs selective update 3.3.2 Static vs dynamic vs flexible arrays 3.4 Copy semantics vs reference semantics 3.5 Lifetime 3.5.1 Global and local variables 3.5.2 Heap variables 3.5.3 Persistent variables 3.6 Pointers 3.6.1 Pointers and recursive types 3.6.2 Dangling pointers 3.7 Commands 3.7.1 Skips 3.7.2 Assignments 3.7.3 Proper procedure calls 3.7.4 Sequential commands 3.7.5 Collateral commands 3.7.6 Conditional commands 3.7.7 Iterative commands 3.8 Expressions with side effects 3.8.1 Command expressions 3.8.2 Expression-oriented languages 3.9 Implementation notes 3.9.1 Storage for global and local variables 3.9.2 Storage for heap variables 3.9.3 Representation of dynamic and flexible arrays Summary Further reading