If you need to parse or process text data in Linux or Unix, this useful book explains how to use flex and bison to solve your problems quickly. flex & bison is the long-awaited sequel to the classic O'Reilly book, lex & yacc. In the nearly two decades since the original book was published, the flex and bison utilities have proven to be more reliable and more powerful than the original Unix tools. flex & bison covers the same core functionality vital to Linux and Unix program development, along with several important new topics. You'll find revised tutorials for novices and references for…mehr
If you need to parse or process text data in Linux or Unix, this useful book explains how to use flex and bison to solve your problems quickly. flex & bison is the long-awaited sequel to the classic O'Reilly book, lex & yacc. In the nearly two decades since the original book was published, the flex and bison utilities have proven to be more reliable and more powerful than the original Unix tools. flex & bison covers the same core functionality vital to Linux and Unix program development, along with several important new topics. You'll find revised tutorials for novices and references for advanced users, as well as an explanation of each utility's basic usage and simple, standalone applications you can create with them. With flex & bison, you'll discover the wide range of uses these flexible tools offer. * Address syntax crunching that regular expressions tools can't handle * Build compilers and interpreters, and handle a wide range of text processing functions * Interpret code, configuration files, or any other structured format * Learn key programming techniques, including abstract syntax trees and symbol tables * Implement a full SQL grammar-with complete sample code * Use new features such as pure (reentrant) lexers and parsers, powerful GLR parsers, and interfaces to C++
John Levine, founder of Taughannock Networks, writes, speaks, and consults on e-mail, the Internet, and other computer topics. He has written over 20 technical books, and is the co-author of O'Reilly's lex & yacc, 2nd Edition and qmail. He's also deeply involved in Internet e-mail in general and spam issues in particular as co-chair of the Internet Research Task Force's Anti-Spam Research Group (http://asrg.sp.am ) and a board member of the Coalition Against Unsolicited Commercial E-mail (http://www.cauce.org.)He lives and works in the tiny village of Trumansburg NY (http://www.trumansburg.ny.us) where he reports that being the municipal sewer commissioner was a much cleaner job than dealing with spammers.
Inhaltsangabe
Inhaltsverzeichnis Chapter 1 Introducing Flex and Bison Lexical Analysis and Parsing Regular Expressions and Scanning Grammars and Parsing Ambiguous Grammars: Not Quite Adding a Few More Rules Flex and Bison vs. Handwritten Scanners and Parsers Exercises Chapter 2 Using Flex Regular Expressions File I/O in Flex Scanners Reading Several Files The I/O Structure of a Flex Scanner Start States and Nested Input Files Symbol Tables and a Concordance Generator C Language Cross-Reference Exercises Chapter 3 Using Bison How a Bison Parser Matches Its Input Shift/Reduce Parsing A Bison Parser Abstract Syntax Trees An Improved Calculator That Creates ASTs Shift/Reduce Conflicts and Operator Precedence An Advanced Calculator Using the Advanced Calculator Exercises Chapter 4 Parsing SQL A Quick Overview of SQL Manipulating Relations Three Ways to Use SQL SQL to RPN The Lexer The Parser The Makefile for the SQL Parser Exercises Chapter 5 A Reference for Flex Specifications Structure of a Flex Specification BEGIN C++ Scanners Context Sensitivity Definitions (Substitutions) ECHO Input Management Flex Library Interactive and Batch Scanners Line Numbers and yylineno Literal Block Multiple Lexers in One Program Options When Building a Scanner Portability of Flex Lexers Reentrant Scanners Regular Expression Syntax REJECT Returning Values from yylex() Start States unput() yyinput() yyunput() yyleng yyless() yylex() and YY_DECL yymore() yyrestart() yy_scan_string and yy_scan_buffer YY_USER_ACTION yywrap() Chapter 6 A Reference for Bison Specifications Structure of a Bison Grammar Actions Ambiguity and Conflicts Bugs in Bison Programs C++ Parsers %code Blocks End Marker Error Token and Error Recovery Inherited Attributes ($0) %initial-action Lexical Feedback Literal Block Literal Tokens Locations %parse-param Portability of Bison Parsers Precedence and Associativity Declarations Recursive Rules Rules Special Characters %start Declaration Symbol Values Tokens Variant and Multiple Grammars Multiple Parsers y.output Files Bison Library YYABORT YYACCEPT YYBACKUP yyclearin yydebug and YYDEBUG yyerrok YYERROR yyerror() yyparse() YYRECOVERING() Chapter 7 Ambiguities and Conflicts The Pointer Model and Conflicts Kinds of Conflicts Parser States Contents of name.output Reduce/Reduce Conflicts Shift/Reduce Conflicts Review of Conflicts in name.output Common Examples of Conflicts How Do You Fix the Conflict? Summary Exercises Chapter 8 Error Reporting and Recovery Error Reporting Locations Error Recovery Bison Error Recovery Compiler Error Recovery Exercises Chapter 9 Advanced Flex and Bison Pure Scanners and Parsers GLR Parsing C++ Parsers Exercises Appendix SQL Parser Grammar and Cross-Reference Glossary Colophon
Inhaltsverzeichnis Chapter 1 Introducing Flex and Bison Lexical Analysis and Parsing Regular Expressions and Scanning Grammars and Parsing Ambiguous Grammars: Not Quite Adding a Few More Rules Flex and Bison vs. Handwritten Scanners and Parsers Exercises Chapter 2 Using Flex Regular Expressions File I/O in Flex Scanners Reading Several Files The I/O Structure of a Flex Scanner Start States and Nested Input Files Symbol Tables and a Concordance Generator C Language Cross-Reference Exercises Chapter 3 Using Bison How a Bison Parser Matches Its Input Shift/Reduce Parsing A Bison Parser Abstract Syntax Trees An Improved Calculator That Creates ASTs Shift/Reduce Conflicts and Operator Precedence An Advanced Calculator Using the Advanced Calculator Exercises Chapter 4 Parsing SQL A Quick Overview of SQL Manipulating Relations Three Ways to Use SQL SQL to RPN The Lexer The Parser The Makefile for the SQL Parser Exercises Chapter 5 A Reference for Flex Specifications Structure of a Flex Specification BEGIN C++ Scanners Context Sensitivity Definitions (Substitutions) ECHO Input Management Flex Library Interactive and Batch Scanners Line Numbers and yylineno Literal Block Multiple Lexers in One Program Options When Building a Scanner Portability of Flex Lexers Reentrant Scanners Regular Expression Syntax REJECT Returning Values from yylex() Start States unput() yyinput() yyunput() yyleng yyless() yylex() and YY_DECL yymore() yyrestart() yy_scan_string and yy_scan_buffer YY_USER_ACTION yywrap() Chapter 6 A Reference for Bison Specifications Structure of a Bison Grammar Actions Ambiguity and Conflicts Bugs in Bison Programs C++ Parsers %code Blocks End Marker Error Token and Error Recovery Inherited Attributes ($0) %initial-action Lexical Feedback Literal Block Literal Tokens Locations %parse-param Portability of Bison Parsers Precedence and Associativity Declarations Recursive Rules Rules Special Characters %start Declaration Symbol Values Tokens Variant and Multiple Grammars Multiple Parsers y.output Files Bison Library YYABORT YYACCEPT YYBACKUP yyclearin yydebug and YYDEBUG yyerrok YYERROR yyerror() yyparse() YYRECOVERING() Chapter 7 Ambiguities and Conflicts The Pointer Model and Conflicts Kinds of Conflicts Parser States Contents of name.output Reduce/Reduce Conflicts Shift/Reduce Conflicts Review of Conflicts in name.output Common Examples of Conflicts How Do You Fix the Conflict? Summary Exercises Chapter 8 Error Reporting and Recovery Error Reporting Locations Error Recovery Bison Error Recovery Compiler Error Recovery Exercises Chapter 9 Advanced Flex and Bison Pure Scanners and Parsers GLR Parsing C++ Parsers Exercises Appendix SQL Parser Grammar and Cross-Reference Glossary Colophon
Rezensionen
"Ein echter Gewinn für Jedermann, der eine knapp gefasste praxisnahe Darstellung der Funktionsweise des Scanner/Parser-Paars flex und bison sucht. Auf wenigen Seiten und anhand weniger, aber umfassender Beispiele wird deren Funktionsweise plastisch und erschöpfend dargestellt und ausführlich kommentiert. Abgerundet wird diese exemplarische Einführung durch eine gut lesbare narrativ geschriebene Referenz zu beiden Tools, sowie einem ausführlichen Abschnitt zur Fehlersuche im bison-Parser. Der Band ist eine unverzichtbare Pflichtlektüre für jeden, der sich mit Compilerbau vertraut machen möchte. Eine rundum gelungene Neuauflage des Klassikers zu lex und yacc." -- IT Stammtisch Darmstadt, Mai 2010
Es gelten unsere Allgemeinen Geschäftsbedingungen: www.buecher.de/agb
Impressum
www.buecher.de ist ein Shop der buecher.de GmbH & Co. KG Bürgermeister-Wegele-Str. 12, 86167 Augsburg Amtsgericht Augsburg HRA 13309