Language Implementation Patterns(English, Paperback, Parr Terence) | Zipri.in
Language Implementation Patterns(English, Paperback, Parr Terence)

Language Implementation Patterns(English, Paperback, Parr Terence)

Quick Overview

Rs.3800 on FlipkartBuy
Product Price Comparison
Knowing how to create domain-specific languages (DSLs) can give you a huge productivity boost. Instead of writing code in a general-purpose programming language, you can first build a custom language tailored to make you efficient in a particular domain. The key is understanding the common patterns found across language implementations. Language Implementation Patterns identifies and condenses the most common design patterns, providing sample implementations of each. The pattern implementations use Java, but the patterns themselves are completely general. Some of the implementations use the well-known ANTLR parser generator, so readers will find this book an excellent source of ANTLR examples as well. But this book will benefit anyone interested in implementing languages, regardless of their tool of choice. Other language implementation books focus on compilers, which you rarely need in your daily life. Instead, Language Design Patterns shows you patterns you can use for all kinds of language applications. You’ll learn to create configuration file readers, data readers, model-driven code generators, source-to-source translators, source analyzers, and interpreters. Each chapter groups related design patterns and, in each pattern, you’ll get hands-on experience by building a complete sample implementation. By the time you finish the book, you’ll know how to solve most common language implementation problems. About the Author Terence Parr is a professor of computer science and graduate program director at the University of San Francisco, where he continues to work on his ANTLR parser generator (http://www.antlr.org) and template engine (http://www.stringtemplate.org). Terence has consulted for and held various technical positions at companies such as IBM, Lockheed Missiles and Space, NeXT, and Renault Automation. Terence holds a Ph.D. in computer engineering from Purdue University and was a postdoctoral fellow at the Army High-Performance Computing Research Center at the University of Minnesota, where he built parallelizing FORTRAN source-to-source translators. He is the author of The Definitive ANTLR Reference. Table of Contents Acknowledgments Preface What to Expect from This Book How This Book Is Organized What You’ll Find in the Patterns Who Should Read This Book How to Read This Book Languages and Tools Used in This Book I Getting Started with Parsing 1 Language Applications Cracked Open 1.1 The Big Picture 1.2 A Tour of the Patterns 1.3 Dissecting a Few Applications 1.4 Choosing Patterns and Assembling Applications 2 Basic Parsing Patterns 2.1 Identifying Phrase Structure 2.2 Building Recursive-Descent Parsers 2.3 Parser Construction Using a Grammar DSL 2.4 Tokenizing Sentences P.1. Mapping Grammars to Recursive-Descent Recognizers P.2. LL(1) Recursive-Descent Lexer P.3. LL(1) Recursive-Descent Parser P.4. LL(k) Recursive-Descent Parser 3 Enhanced Parsing Patterns 3.1 Parsing with Arbitrary Lookahead 3.2 Parsing like a Pack Rat 3.3 Directing the Parse with Semantic Information P.5. Backtracking Parser P.6. Memoizing Parser P.7. Predicated Parser II Analyzing Languages 4 Building Intermediate Form Trees 4.1 Why We Build Trees 4.2 Building Abstract Syntax Trees 4.3 Quick Introduction to ANTLR 4.4 Constructing ASTs with ANTLR Grammars P.8. Parse Tree P.9. Homogeneous AST P.10. Normalized Heterogeneous AST P.11. Irregular Heterogeneous AST 5 Walking and Rewriting Trees 5.1 Walking Trees and Visitation Order 5.2 Encapsulating Node Visitation Code 5.3 Automatically Generating Visitors from Grammars 5.4 Decoupling Tree Traversal from Pattern Matching P.12. Embedded Heterogeneous Tree Walker P.13. External Tree Visitor P.14. Tree Grammar P.15. Tree Pattern Matcher 6 Tracking and Identifying Program Symbols 6.1 Collecting Information About Program Entities 6.2 Grouping Symbols into Scopes 6.3 Resolving Symbols P.16. Symbol Table for Monolithic Scope P.17. Symbol Table for Nested Scopes 7 Managing Symbol Tables for Data Aggregates 7.1 Building Scope Trees for Structs 7.2 Building Scope Trees for Classes P.18. Symbol Table for Data Aggregates P.19. Symbol Table for Classes 8 Enforcing Static Typing Rules P.20. Computing Static Expression Types P.21. Automatic Type Promotion P.22. Enforcing Static Type Safety P.23. Enforcing Polymorphic Type Safety III Building Interpreters 9 Building High-Level Interpreters 9.1 Designing High-Level Interpreter Memory Systems 9.2 Tracking Symbols in High-Level Interpreters 9.3 Processing Instructions P.24. Syntax-Directed Interpreter P.25. Tree-Based Interpreter 10 Building Bytecode Interpreters 10.1 Programming Bytecode Interpreters 10.2 Defining an Assembly Language Syntax 10.3 Bytecode Machine Architecture 10.4 Where to Go from Here P.26. Bytecode Assembler P.27. Stack-Based Bytecode Interpreter P.28. Register-Based Bytecode Interpreter IV Translating and Generating Languages 11 Translating Computer Languages 11.1 Syntax-Directed Translation 11.2 Rule-Based Translation 11.3 Model-Driven Translation 11.4 Constructing a Nested Output Model P.29. Syntax-Directed Translator P.30. Rule-Based Translator P.31. Target-Specific Generator Classes 12 Generating DSLs with Templates 12.1 Getting Started with StringTemplate 12.2 Characterizing StringTemplate 12.3 Generating Templates from a Simple Input Model 12.4 Reusing Templates with a Different Input Model 12.5 Using a Tree Grammar to Create Templates 12.6 Applying Templates to Lists of Data 12.7 Building Retargetable Translators 13 Putting It All Together 13.1 Finding Patterns in Protein Structures 13.2 Using a Script to Build 3D Scenes 13.3 Processing XML 13.4 Reading Generic Configuration Files 13.5 Tweaking Source Code 13.6 Adding a New Type to Java 13.7 Pretty Printing Source Code 13.8 Compiling to Machine Code A. Bibliography Index