CHF63.00
Download steht sofort bereit
Long-awaited revision to a unique guide that covers both compilers
and interpreters Revised, updated, and now focusing on Java instead
of C++, this long-awaited, latest edition of this popular book
teaches programmers and software engineering students how to write
compilers and interpreters using Java. You?ll write compilers and
interpreters as case studies, generating general assembly code for
a Java Virtual Machine that takes advantage of the Java Collections
Framework to shorten and simplify the code. In addition, coverage
includes Java Collections Framework, UML modeling, object-oriented
programming with design patterns, working with XML intermediate
code, and more.
Autorentext
Ronald Mak wrote the earlier editions of this very successful book as well as The Martian Principles for Successful Enterprise Systems: 20 Lessons Learned from NASA's Mars Exploration Rover Mission (also published by Wiley). He is also the author of Java Number Cruncher: The Java Programmer's Guide to Numerical Computing. He develops advanced software systems for organizations from startups to NASA. Currently a research staff member at the IBM Almaden Research Center, he also teaches compiler writing and software engineering at San José State University.
Klappentext
Master the skills you need to build your own compilers and interpreters
Compilers and interpreters are very difficult programs to write, but modern software engineering tackles the complexity. Design patterns and other object-oriented programming techniques guide you to develop well-structured code in incremental, understandable steps. Apply what you learn in this book to succeed with any complex software project.
You'll learn to:
Use Java to develop scanners and parsers for programming languages
Employ UML to model software components
Manage symbol tables with the Java Collections Framework
Use XML to represent the generated intermediate code
Develop an interpreter to execute programs, including a powerful interactive source-level debugger
Implement an integrated development environment (IDE) that animates the execution of programs
Use the IDE's graphical user interface to set breakpoints and single-step programs statement by statement with mouse clicks
Develop a code generator that emits object code for the Java Virtual Machine (JVM), and run the compiled code on multiple platforms
Zusammenfassung
Long-awaited revision to a unique guide that covers both compilers and interpreters Revised, updated, and now focusing on Java instead of C++, this long-awaited, latest edition of this popular book teaches programmers and software engineering students how to write compilers and interpreters using Java. You?ll write compilers and interpreters as case studies, generating general assembly code for a Java Virtual Machine that takes advantage of the Java Collections Framework to shorten and simplify the code. In addition, coverage includes Java Collections Framework, UML modeling, object-oriented programming with design patterns, working with XML intermediate code, and more.
Inhalt
Introduction xxi
Chapter 1 Introduction 1
Goals and Approach 1
What Are Compilers and Interpreters? 2
Comparing Compilers and Interpreters 4
The Picture Gets a Bit Fuzzy 5
Why Study Compiler Writing? 6
Conceptual Design 6
Syntax and Semantics 8
Lexical, Syntax, and Semantic Analyses 10
Chapter 2 Framework I: Compiler and Interpreter 11
Goals and Approach 11
Language-Independent Framework Components 12
Front End 13
Parser 16
Intermediate Tier 34
Back End 36
Pascal-Specific Front End Components 37
Pascal Parser 37
Pascal Scanner 39
A Front End Factory 41
Initial Back End Implementations 43
Interpreter 44
A Back End Factory 45
Program 2: Program Listings 46
Chapter 3 Scanning 55
Goals and Approach 55
Program 3: Pascal Tokenizer 57
Syntax Error Handling 65
How to Scan for Tokens 72
A Pascal Scanner 75
Pascal Tokens 77
Syntax Diagrams 80
Word Tokens 81
String Tokens 82
Special Symbol Tokens 85
Number Tokens 88
Chapter 4 The Symbol Table 97
Goals and Approach 97
Symbol Table Conceptual Design 98
The Symbol Table Stack 98
Symbol Table Interfaces 100
A Symbol Table Factory 105
Symbol Table Implementation 107
Program 4: Pascal Cross-Referencer I 113
Chapter 5 Parsing Expressions and Assignment Statements 121
Goals and Approach 121
Syntax Diagrams 122
Intermediate Code Conceptual Design 125
Intermediate Code Interfaces 126
An Intermediate Code Factory 129
Intermediate Code Implementation 130
Printing Parse Trees 135
Parsing Pascal Statements and Expressions 141
Parsing Statements 145
Parsing the Compound Statement 148
Parsing the Assignment Statement 149
Parsing Expressions 151
Program 5: Pascal Syntax Checker I 161
Chapter 6 Interpreting Expressions and Assignment Statements 167
Goals and Approach 167
Runtime Error Handling 168
Executing Assignment Statements and Expressions 170
The Statement Executor Subclasses 170
Executing Statements 173
Executing the Compound Statement 175
Executing the Assignment Statement 175
Executing Expressions 177
Program 6: Simple Interpreter I 184
Chapter 7 Parsing Control Statements 189
Goals and Approach 189
Syntax Diagrams 190
Error Recovery 191
Program 7: Syntax Checker Ii 192
Control Statement Parsers 193
Parsing Pascal Control Statements 198
Parsing the REPEAT Statement 198
Parsing the WHILE Statement 202
Parsing the FOR Statement 207
Parsing the IF Statement 214
Parsing the CASE Statement 219
Chapter 8 Interpreting Control Statements 233
Goals and Approach 233
Program 8: Simple Interpreter Ii 233
Interpreting Control Statements 234
Executing a Looping Statement 236
Executing the IF Statement 240
Executing the SELECT Statement 241
An Optimized SELECT Executor 245
Chapter 9 Parsing Declarations 249
Goals and Approach 249
Pascal Declarations 250
Types and the Symbol Table 253
Type Specification Interfaces 253
Pascal Type Specification Implementation 255
A Type Factory 260
Scope and the Symbol Table Stack 261
How Identifiers Are Defined 266 Predefined Types and Constants 268</...