没有合适的资源?快使用搜索试试~ 我知道了~
首页Programming Language Processors in Java- Compilers and Interpreters
Programming Language Processors in Java- Compilers and Interpret...
需积分: 10 56 浏览量
更新于2023-05-29
评论
收藏 35.98MB PDF 举报
Programming Language Processors in Java- Compilers and Interpreters
资源详情
资源评论
资源推荐

Programming Language
Processors in Java
COMPILERS AND INTERPRETERS
DAVID
A
WATT
University of Glasgow, Scotland
and
DERYCK
F
BROWN
The
Robert Gordon University, Scotland
An
imprint
of
Pearson
Education
Harlow, England
.
London
.
New York
.
Reading, Massachusetts
.
San Francisco
.
Toronto
.
Don Mills, Ontario
.
Sydney
Tokyo
.
Singapore
.
Hong Kong
.
Seoul
.
Taipei
.
Cape Town
.
Madrid
.
Mexico City
.
Amsterdam
.
Munich
.
Paris
.
Milan
www.allitebooks.com

Pearson Education Limited
Edinburgh Gate
Harlow
Essex, CM20 2JE
England
and Associated Companies throughout the world
Visit us on the World Wide Web at:
http://www.pearsoneduc.com
First published 2000
0
Pearson Education Limited 2000
The rights of David A Watt and Deryck
F
Brown to be identified as authors of this
Work have been asserted by them in accordance with the Copyright, Designs and
Patents Act 1988.
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 or otherwise, without either the prior
written permission of the Publishers or
a
licence permitting restricted copying
in the United Kingdom issued by the Copyright Licensing Agency Ltd.,
90 Tottenham Court Road London WlP OLP.
Many of the designations used by manufacturers and sellers to distinguish their
products are claimed as trademarks. Pearson Education Limited has made every
attempt to supply trademark information about manufacturers and their products
mentioned in this book. A list of the trademark designations and their owners appears
on page
x.
ISBN 0 130 25786 9
British Library Cataloguing in Publication Data
A catalogue record for this book is available from the British Library.
Library
of'Congrrss
Cutaloging-in-Publication
Data
Watt, David A. (David Anthony)
Programming language processors in Java
:
compilers and interpreters
/
David A. Watt
and Deryck
F.
Brown
p. cm.
Includes bibliographical references.
ISBN 0-1 3425786-9 (case)
1.
Java (Computer program language) 2. Compilers (Computer programs) 3.
Interpreters (Computer programs)
1.
Brown, Deryck F.
11.
Title.
Typeset by
7
Printed an bound in Great Britain by Biddles Ltd, www.biddles.co.uk
www.allitebooks.com

Contents
Preface
1
Introduction
1.1 Levels of programming language
1.2
Programming language processors
1.3 Specification of programming languages
1.3.1 Syntax
1.3.2 Contextual constraints
1.3.3 Semantics
1.4
Case study: the programming language Triangle
1.5
Further reading
Exercises
2
Language Processors
Translators and compilers
Interpreters
Real and abstract machines
interpretive
compilers
Portable compilers
Bootstrapping
2.6.1 Bootstrapping a portable compiler
2.6.2 Full bootstrap
2.6.3 Half bootstrap
2.6.4 Bootstrapping to improve efficiency
Case study: the Triangle language processor
Further reading
Exercises
3
Compilation
3.1 Phases
3.1.1 Syntactic analysis
3.1.2 Contextual analysis
3.1.3 Code generation
3.2 Passes
www.allitebooks.com

vi
Programming Language Processors in Java
3.2.1 Multi-pass compilation
3.2.2 One-pass compilation
3.2.3 Compiler design issues
3.3
Case study: the Triangle compiler
3.4 Further reading
Exercises
4
Syntactic Analysis
4.1 Subphases of syntactic analysis
4.1.1 Tokens
4.2 Grammars revisited
4.2.1 Regular expressions
4.2.2 Extended BNF
4.2.3 Grammar transformations
4.2.4 Starter sets
4.3 Parsing
4.3.1 The bottom-up parsing strategy
4.3.2 The top-down parsing strategy
4.3.3 Recursive-descent parsing
4.3.4 Systematic development of a recursive-descent parser
4.4 Abstract syntax trees
4.4.1 Representation
4.4.2 Construction
4.5 Scanning
4.6
Case study: syntactic analysis in the Triangle compiler
4.6.1 Scanning
4.6.2 Abstract syntax trees
4.6.3 Parsing
4.6.4 Error handling
4.7 Further reading
Exercises
5
Contextual Analysis
5.1
Identification
5.1.1 Monolithic block structure
5.1.2 Flat block structure
5.1.3 Nested block structure
5.1.4 Attributes
5.1.5 Standard environment
5.2 Typechecking
5.3 A contextual analysis algorithm
5.3.1 Decoration
5.3.2 Visitor classes and objects
5.3.3 Contextual analysis as a visitor object
5.4
Case study: contextual analysis in the Triangle compiler
www.allitebooks.com

Contents
vii
5.4.1 Identification
5.4.2 Type checking
5.4.3 Standard environment
5.5 Further reading
Exercises
6
Run-Time Organization
6.1 Data representation
6.1.1 Primitive types
6.1.2 Records
6.1.3 Disjoint unions
6.1.4 Static arrays
6.1.5 Dynamic arrays
6.1.6 Recursive types
6.2 Expression evaluation
6.3 Static storage allocation
6.4 Stack storage allocation
6.4.1 Accessing local and global variables
6.4.2 Accessing nonlocal variables
6.5 Routines
6.5.1
Routine protocols
6.5.2 Static links
6.5.3 Arguments
6.5.4 Recursion
6.6 Heap storage allocation
6.6.1 Heap management
6.6.2 Explicit storage deallocation
6.6.3 Automatic storage deallocation and garbage collection
6.7
Run-time organization for object-oriented languages
6.8
Case study: the abstract machine TAM
6.9
Further reading
Exercises
7
Code Generation
7.1 Code selection
7.1.1 Code templates
7.1.2 Special-case code templates
7.2 A code generation algorithm
7.2.1 Representation of the object program
7.2.2 Systematic development of a code generator
7.2.3 Control structures
7.3
Constants and variables
7.3.1 Constant and variable declarations
7.3.2 Static storage allocation
7.3.3 Stack storage allocation
www.allitebooks.com
剩余437页未读,继续阅读















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0