Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


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++

Subscriber Reviews

Average Rating: 4.25 out of 5 rating Based on 4 Ratings

"Like the author didn't really want to write it" - by ekeyser on 04-JUL-2011
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
One of the really annoying things about this book, at least online, is that none or almost none of the code snippets indicate the file name.

When dealing with something as complicated as scanners and parsers and the multiple files they use doesn't it seem obvious to indicate which code goes in what file??

I've actually been on where someone asks a question about code syntax specifically mentioning this book where it wasn't obvious that the book means for code snippets to live in a Makefile and not run on the command line.

Simple stuff like this...

The following code lives in our "Makefile":
scanner:        scanner.l parser.y
                bison -d -t parser.y
                flex scanner.l
                gcc -o $@ lex.yy.c -lfl

Not simply...

"And this gives us..."
scanner.l parser.y
bison -d -t parser.y
flex scanner.l
gcc -o $@ lex.yy.c -lfl

Report as Inappropriate

Table of Contents



The publisher has provided additional content related to this title.


Visit the catalog page for flex & bison

  • Catalog Page

Visit the errata page for flex & bison

  • Errata