Techniques For Searching, Parsing, And Matching

calcActive())">
- ISBN/EAN
- 9788854862357
- Editore
- Aracne
- Formato
- Brossura
- Anno
- 2013
- Edizione
- 4
- Pagine
- 292
Disponibile
18,00 €
In this book we present some techniques for exploring trees and graphs. We illustrate the linear search technique and the backtracking technique and, as instances of tree exploration methods, we present various algorithms for parsing subclasses of context–free languages. They include: (i) the chop–and–expand parsers for LL(k) languages, (ii) the shift–and–reduce parsers for LR(k) languages and, among them, the LR(0), the SLR(1), the LR(1), and the LALR(1) parsers, and (iii) the operator–precedence parsers. We illustrate the use of the parser generators Bison and Yacc, and the lexical analyzer generator Flex. We also illustrate some tree exploration and manipulation methods by presenting algorithms for visiting trees, evaluating boolean expressions, proving propositional formulas, and encoding trees. We consider the minimal spanning tree problem in undirected graphs and the shortest path problem in directed graphs. For the latter problem we present the solutions based on boolean matrix multiplication, semirings, and dynamic programming. Finally, we consider the pattern–matching problem and we analyze the Knuth–Morris–Pratt algorithm. In the appendices we present some parsing programs using Prolog, and we briefly recall some decidability results concerning the LL(k) languages and the LR(k) languages.
Maggiori Informazioni
| Autore | Pettorossi Alberto |
|---|---|
| Editore | Aracne |
| Anno | 2013 |
| Tipologia | Libro |
| Num. Collana | 0 |
| Lingua | Inglese |
| Indice | Preface 7 Chapter 1. Preliminary Definitions on Languages and Grammars 9 1.1. Free Monoids and Languages 9 1.2. Formal Grammars 10 Chapter 2. Exploring Search Spaces 17 2.1. Exploring Linear Search Spaces 17 2.2. Backtracking Algorithms 21 2.3. Visiting Trees While Looking for Good Nodes 29 2.3.1. Depth First Visit of Trees: Basic Version 29 2.3.2. Depth First Visit of Trees: Burstall’s Version 31 2.3.3. Breadth First Visit of Trees 33 Chapter 3. Chop-and-Expand Parsers for Context-Free Languages 35 3.1. Chop-and-Expand Context-Free Parser in a Functional Language 35 3.2. Chop-and-Expand Context-Free Parser in Java 39 3.3. Chop-and-Expand Context-Free Parser in a Logic Language 50 Chapter 4. Parsers for Deterministic Context-Free Languages: LL(k) Parsers 51 4.1. Introduction to LL(k) Parsing 51 4.2. LL(1) Parsers 53 4.3. LL(k) Parsers (for k≥1) 63 Chapter 5. Parsers for Deterministic Context-Free Languages: LR(k) Parsers 81 5.1. Introduction to LR(k) Parsing 81 5.2. LR(0) Parsers 83 5.2.1. Avoiding the Powerset Construction for LR(0) Parsing 94 5.2.2. Remarks on the Hypotheses for LR(k) Parsing 95 5.3. SLR(1) Parsers 97 5.4. LR(1) Parsers 102 5.4.1. Avoiding the Powerset Construction for LR(1) Parsing 118 5.4.2. More Remarks on the Hypotheses for LR(k) Parsing 119 5.5. LALR(1) Parsers 123 5.6. Time and Space Complexity Results for Context-Free Parsing 134 5.7. Conventions for LL(k) and LR(k) parsing 137 5.8. Subclasses of Context-free Languages 138 Chapter 6. Parsers for Operator Grammars and Parser Generators 145 6.1. Operator-Precedence Parsers 145 56 CONTENTS 6.2. Use of Parser Generators 150 6.2.1. Generation of Parsers Using Bison 150 6.2.2. Generation of Lexical Analyzers Using Flex 165 6.2.3. Suggestions for Constructing Parsers 167 6.3. Summary on Parsing of Context-Free Languages 168 6.3.1. Summary on LR(0) and LR(1) Parsing 170 Chapter 7. Visits of Trees and Graphs and Evaluation of Expressions 173 7.1. Depth First Visit of Trees 173 7.2. Evaluator of Boolean Expressions 183 7.3. A Theorem Prover for the Propositional Calculus 194 7.4. Encoding of n-ary Trees Using Binary Trees 207 7.5. Minimal Spanning Tree of an Undirected Graph 223 Chapter 8. Path Problems in Directed Graphs 235 8.1. Matrix Multiplication Algorithms 235 8.2. Comparing Matrix Multiplication Algorithms 237 8.3. Fast Boolean Matrix Multiplication 238 8.4. IC-Semirings and Path Problems in Directed Graphs 239 8.5. Transitive Closure in Directed Graphs: the Reachability Problem 241 8.6. Reducing Transitive Closure to Boolean Matrix Multiplication 242 8.7. Transitive Closure in IC-Semirings: the Shortest Path Problem 245 8.8. Single Source Shortest Paths in Directed Graphs 247 8.9. From Nondeterministic Finite Automata to Regular Expressions 258 Chapter 9. String Matching 261 9.1. Knuth-Morris-Pratt Pattern Matching 261 9.1.1. Time Complexity Analysis of the Knuth-Morris-Pratt Algorithm 267 9.1.2. Java Implementation of the Knuth-Morris-Pratt Algorithm 269 9.2. String Matching in Prolog 271 Chapter 10. Appendices 273 10.1. Simple Prolog Programs and Parsing Sentences in Prolog 273 10.2. Decidability Results for LL(k) and LR(k) Grammars and Languages 277 List of Algorithms and Programs 279 Index 281 Bibliography 287 |
| Disponibilità | Disponibilità: 3-5 gg |
Questo libro è anche in:
