Book description
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++
Publisher resources
Table of contents
- flex & bison
- Preface
- 1. Introducing Flex and Bison
- 2. Using Flex
- 3. Using Bison
- 4. Parsing SQL
-
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()
-
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()
- 7. Ambiguities and Conflicts
- 8. Error Reporting and Recovery
- 9. Advanced Flex and Bison
- A. SQL Parser Grammar and Cross-Reference
- Glossary
- Index
- About the Author
- Colophon
- Copyright
Product information
- Title: flex & bison
- Author(s):
- Release date: August 2009
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781449379278
You might also like
book
Rust in Action
Rust in Action introduces the Rust programming language by exploring numerous systems programming concepts and techniques. …
book
HTTP/2 in Action
HTTP/2 in Action is a complete guide to HTTP/2, one of the core protocols of the …
book
Programming TypeScript
Any programmer working with a dynamically typed language will tell you how hard it is to …
book
Command-Line Rust
Updated in 2024: A new version has been released that simplifies the programs used in the …