lex & yacc, 2nd Edition (A Nutshell Handbook)
| |||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||
| Sort customer reviews by: | |||||||||||||||||||||||||||||
|
Show All Reviews on Page
Hide All Reviews on Page
| |||||||||||||||||||||||||||||
| lex & yacc, 2nd Edition (A Nutshell Handbook) | |||||||||||||||||||||||||||||
|
This book shows you how to use two Unix utilities, lex and yacc, in program development. These tools help programmers build compilers and interpreters, but they also have a wider range of applications. The second edition contains completely revised tutorial sections for novice users and reference sections for advanced users. This edition is twice the size of the first and has an expanded index. The following material has been added:
|
|||||||||||||||||||||||||||||
| Reader Reviews 1 - 15 of 15 | |||||||||||||||||||||||||||||
| Review Date |
Review Rating(5 High) |
Review Helpful to: |
Customer Review | Reviewer Info |
Permanent Link |
||||||||||||||||||||||||
| Reader Reviews Below Sorted by Newest First | |||||||||||||||||||||||||||||
| 10-21-07 | 5 | (NA) |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
This item is a definite must for coursework dealing with scanning and parsing. I thought that I would be fine if I just relied on web sources to assist me in Lex assignments, but as a deadline approached and I still had no results I turned to this book. The content is clear, concise, and absolutely fantastic. If you want to know how to work with Lex and Yacc, this is the book you need.
(Review Data Last Updated: 2008-11-19 05:49:14 EST)
|
|||||||||||||||||||||||||||||
| 12-14-06 | 4 | 1\1 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
I like this book because it is a good compromise between lex & yacc man pages and the theory found in books such as the Dragon book. You will get valuable information about the how and why of the tools that will help you to produce a quality grammar without being overwhelmed by details.
(Review Data Last Updated: 2007-10-22 00:58:48 EST)
|
|||||||||||||||||||||||||||||
| 08-23-06 | 3 | (NA) |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
To me a great book flows into your mind, magically providing the information in the order you need it. Of course it depends on whose reading it, but this book, though well worth the 96 cents bargain bin price I paid for it, does not build the constructs in my head the way I'd like.
Authors should always proofread their books with novices, not the experts. Experts fill in the gaps as they read and don't notice if the logic is missing a link. In chap 2, "Using Lex", there is the sentence: "Lex itself doesn't produce an executable program; instead it translates the lex specification into a file containing a C routine called yylex(). Your program calls yylex() to run the lexer." I waited with baited breath for what it means to "run the lexer". Does it return a token each time you call it? Does it analyze all the input then return? The text ignores this detail and merrily goes on into other details. The chapter is called "Using Lex", but the authors omit how you use it! Of course you can scrounge around in the examples and finally root it out, but a book should paint a crystal clear picture, get you oriented, then drop in the details to build your understanding. The book looks so promising, sort of like the beauty of the original "The C Programming Language" by Kernighan and Ritchie, but disappoints in it's fragmented exposition. I did take a compiler course with the "dragon book" years ago and write a parser, so I'm not totally in the dark, but I expected this book to lay the subject out in a much clearer way. But it is still a good book to have and read "offline". I hope the authors take a crack at another edition and explain it all better. (Review Data Last Updated: 2007-06-24 13:46:13 EST)
|
|||||||||||||||||||||||||||||
| 06-26-06 | 5 | 4\4 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
Yacc (yet another compiler compiler) and its companion lex (lexical analyzer) are primarily intended to allow quick and easy development of small special-purpose languages. The common mistake is assuming that they are only useful for creating compilers for massively complex eccentric languages. This is not the case, though you could no doubt use them for such a purpose.
Lex and Yacc are commonly used together. Yacc uses a formal grammar to parse an input stream, something which lex cannot do using simple regular expressions since lex is limited to simple finite state automata. However, yacc cannot read from a simple input stream - it requires a series of tokens. Lex is often used to provide yacc with these tokens. As a result, building an application in lex and yacc is often used as an exercise in classes on programming languages and the theory of computation to demonstrate key concepts. The book starts out building a simple character-driven calculator, and then moves on to build a menu generation language that produces C code that uses the standard "curses" library to draw menus on the screen. The final application is a SQL parser which includes a quick overview of both relational databases and SQL. Some readers will dislike the fact that Lex and Yacc are only capable of generating C code. Thus, the logical conclusion is that you must be able to write C code in order to use these tools. While it would be nice if the sections about the menu generation language and the SQL parser had some information about how to do typechecking and other such things, this book is not about writing a compiler/interpreter using Lex & Yacc. Rather it is just a beginner's guide. The sections about shift/reduce and reduce/reduce conflicts are especially helpful, as are the sections going over the differences and caveats relating to the major versions of lex and yacc such as AT&T's Lex & YACC, GNU's Flex & Bison, and Berkeley's Yacc. In summary, if you've never used lex or yacc before and think they might be useful tools for you, and you already know the C programming language, this is a handy book to have. (Review Data Last Updated: 2007-06-24 13:46:13 EST)
|
|||||||||||||||||||||||||||||
| 06-25-06 | 5 | 3\3 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
Yacc (yet another compiler compiler) and its companion lex (lexical analyzer) are primarily intended to allow quick and easy development of small special-purpose languages. The common mistake is assuming that they are only useful for creating compilers for massively complex eccentric languages. This is not the case, though you could no doubt use them for such a purpose.
Lex and Yacc are commonly used together. Yacc uses a formal grammar to parse an input stream, something which lex cannot do using simple regular expressions since lex is limited to simple finite state automata. However, yacc cannot read from a simple input stream - it requires a series of tokens. Lex is often used to provide yacc with these tokens. As a result, building an application in lex and yacc is often used as an exercise in classes on programming languages and the theory of computation to demonstrate key concepts. The book starts out building a simple character-driven calculator, and then moves on to build a menu generation language that produces C code that uses the standard "curses" library to draw menus on the screen. The final application is a SQL parser which includes a quick overview of both relational databases and SQL. Some readers will dislike the fact that Lex and Yacc are only capable of generating C code. Thus, the logical conclusion is that you must be able to write C code in order to use these tools. While it would be nice if the sections about the menu generation language and the SQL parser had some information about how to do typechecking and other such things, this book is not about writing a compiler/interpreter using Lex & Yacc. Rather it is just a beginner's guide. The sections about shift/reduce and reduce/reduce conflicts are especially helpful, as are the sections going over the differences and caveats relating to the major versions of lex and yacc such as AT&T's Lex & YACC, GNU's Flex & Bison, and Berkeley's Yacc. In summary, if you've never used lex or yacc before and think they might be useful tools for you, and you already know the C programming language, this is a handy book to have. (Review Data Last Updated: 2006-08-23 09:56:15 EST)
|
|||||||||||||||||||||||||||||
| 06-24-06 | 4 | (NA) |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
This book is a little out-dated. That is fine, though - this book goes over all the essential proponents of Lex and Yacc and Bison and FLEX and all the other variations ... which you will certainly know a lot more about by the end of this book. This books enabled me to read FLEX input from a c-string, which has played a role in a few of my projects. It is great when you just need a quick reminder of the syntax is the tools. This book does not go over how the programs work, which is a good thing, because that would make the book more oriented towards Finite Autonoma and Context Sensive Languages - leave that sort of thing to autonoma theory and compiler design. This is an excellent reference, so buy it if you really need it.
(Review Data Last Updated: 2007-06-24 13:46:13 EST)
|
|||||||||||||||||||||||||||||
| 08-23-05 | 5 | 1\4 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
About the previous review: if the book is "OK", why two stars? Nevertheless, the poster is correct in that the book by Alex Schreiner, Introduction to Compiler Construction With Unix, is very good, and much more detailed and practical than Lex and Yacc by Levine. Which doesn't make the latter a bad book: I think it's the best book to read first; it's simple, friendly, and -- as far as it goes -- very enlightening.
(Review Data Last Updated: 2007-06-24 13:46:13 EST)
|
|||||||||||||||||||||||||||||
| 04-26-04 | 2 | 5\5 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
To keep it simple, the book "Introduction to Compiler Construction in UNIX" introduces and explains LEX/YACC far better than this book. It uses a more realistic example and shows the error handling in more detail. This book is ok for a quick intro, but for a 'real" user, refer to the book I mentioned above.
(Review Data Last Updated: 2006-07-05 14:10:24 EST)
|
|||||||||||||||||||||||||||||
| 04-22-04 | 5 | 2\2 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
Like many O'Reilly books, this is really just an introduction to
something that is hard to get intorduced to. The book is not a definitive guide, but a definitive guide has no starting point. After reading this book, you should be able to construct some simple scanners with lex/flex and parsers with yacc/bison, but more importantly, you should be able to read more definitive documentation. (Review Data Last Updated: 2006-07-05 14:10:24 EST)
|
|||||||||||||||||||||||||||||
| 03-12-04 | 2 | 5\6 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
This book was disappointing. I had hoped for a tutorial and reference on Lex/Yacc Flex/Bison for building language recognisers, but in the tradition of "yet another boring and useless reverse polish notation" calculator - it gives us a desktop infix expression calculator. (How could I have possibly guessed?)
The book presents some interesting material for those who want to parse SQL, but if you're eager to learn about translating programming languages, this book is nearly useless. It gives superficial and confusing treatment of language constructs like "if-then-else" statements, and gives only an exercise for recognising a function call and "playing it back." (I feel these are cop-outs.) It also fails to explain clearly how to construct unambiguous grammars, or use facilities for operator precedence or whatver to control the ambiguity. To be fair, I am guessing this was meant as a reference for Lex/Yacc for those who already know how to construct language recognisers and have some knowledge of using these tools. But then why bother to give especially bad tutorial material in the early chapters if this were the case? This books is also in need of a new edition. (Review Data Last Updated: 2006-07-05 14:10:24 EST)
|
|||||||||||||||||||||||||||||
| 12-26-02 | 4 | 7\8 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
Firstly there are not many books on Lex & Yacc.
Unix programming by Kernighan & Pike provides some necessary information but it is not sufficient to write a complex parser or scanner. In these circumstances this book acts like a God given gift for compiler developers. The examples which introduce the tools are very good. Many guys who desire jobs as compiler developers Hope the authors can consider this request. (Review Data Last Updated: 2006-07-05 14:10:24 EST)
|
|||||||||||||||||||||||||||||
| 10-09-01 | 2 | 4\6 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
There is too much repetition of basic ideas in the first few chapters of the book, and not enough coverage of more advanced topics (like how to use marker nonterminals, how to use $<>$ constructs, etc).
The discussion of shift/reduce and reduce/reduce conflicts in chaper 8 is pretty good though and would make a fine introduction for a beginner wanting to learn /basic/ concepts. Good error handling is definitely a black art, but I still would have liked to have been given more information about it in chapter 9. The examples were also a bit too soft. Chapters 4 and 5 have some interesting (and highly unusual)examples for scanning and parsing applications, but they do not show off many of the advanced capabilites of lex and yacc. What this book really needs are couple of examples that demonstrate how to overcome classic scanning and parsing horrors (like how to do type checking in, say, C); a chapter like this instead of one of chapters 4 or 5 would be great. Even today lex and yacc are very important tools in the computer scientist's toolkit. They were designed 25 (or so) years ago, but /real/ documentation is still nonexistant. This means that unfortunately, this book is one of the best. I think that the FSF's Bison manual is much better value for money. It also does not cover advanced topics in enough depth, but what is does explain, it explains quite clearly. (Review Data Last Updated: 2006-07-05 14:10:24 EST)
|
|||||||||||||||||||||||||||||
| 06-12-01 | 4 | 2\3 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
The book is fairly aged at internet time and should be replaced by a newer editions.
flex and bison/byacc are easier to find as they are free. They need a bit more spaces. Also, people read a book want to spend less time reading the on-line manuals on screen. The C part of the examples are not paradigm work. Uninitialized pointers are casually used and memory are some times never freed. Lex and yacc seems best with well-defined classroom or smaller projects. I am interested to learn how to solve the more complicated real world problems. (Review Data Last Updated: 2006-07-05 14:10:24 EST)
|
|||||||||||||||||||||||||||||
| 05-26-01 | 3 | 20\22 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
WHAT IT IS: A sparse crash course, a jump start in Lex and Yacc for those who already know (1) front-end compiler techniques (lexing and parsing), and (2) the C programming language. If you meet both these daunting prerequisites and can use a bit of sample code to get going, this is for you, but be advised that the Yacc example is only an interactive calculator, not a mini-language. Includes a reference section on Lex and Yacc, sections on Yacc ambiguities and error reporting, and a small glossary which is nice except that the definition of LALR(1) is slightly off (the LR in look-ahead LR means, "Left-to-right scanning of input, Rightmost derivation in reverse)." I found the Lex and Yacc command line options in the examples to be valuable information.
The Yacc examples are more complete than any I found on the web; those all required major surgery or additional pieces to get working. The only problem I had with *these* code samples was that the goofy version of Lex on my Slowlaris system gives an error if the first line of the translation rules section is a {substitution} --once I replaced that with the corresponding regular expression it worked fine, and so did the rest of the code that I ran in chapters 2 and 3. You might have to do similar tweaking. WHAT IT AIN'T: A primer on compilers or parsing (neither are some of the books purporting to be such, for that matter). There's no mini programming language example. And of course it does not promise nor cover code optimization or compiler back-end stuff like code generation. WHAT IT COULD: I would like more examples --ideally, a mini-language compiler that reads source code from one file and puts output (say generated code quadruples) in another. And maybe a parser for some kind of output stream. Chapter 4 on a menu generation language and chapter 5 on a SQL parser are not needed today as far as I know --but I admit that's not very far. :-) WHAT IT CAIN'T: I winced in sympathetic frustration as I read a scathing review screaming bloody murder that this book explains "NOTHING!!!" I know where that poor guy was at, and his frustration is understandable. This book is no substitute for a course on automata theory that covers regular expressions and context-free grammars, plus a *good* compiler course (those are hard to come by) that covers chapters 3 and 4 of the "dragon book." The dragon on the cover of that book symbolizes the complexity of compiler design, correctly indicating that this is a recondite subject. If you are writing your first parser on your own without a solid understanding of terms like "regular expression," "NFA," "CFG," "state diagram," and "LR," then you do not realize the odyssey you are embarking on and this little book on Lex and Yacc won't save you. Many students of Computer Science (including yours truly) regard compilers as the hardest subject. NOTE: Are there dudes out there without all that Comp Sci background who can write parsers? You bet! It can be done, and there are many other books on parser construction now. (Review Data Last Updated: 2006-06-25 13:49:14 EST)
|
|||||||||||||||||||||||||||||
| 02-01-01 | 4 | 4\4 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
lex & yacc used to feed a starving market; people who really needed to know how to write a parser generator and possibly wanted a more general and automatable way to write a lexical analyzer. As one reviewer already noted, those readers were able to work through two or three times and let the information sink in.
The book's been very, very successful. It also hasn't sought to repay the market by refining itself and becoming more accessible to readers. Forget that the principles behind these tools haven't changed; there are or could be fresh examples -- who needs help writing a curses-based, menu-driven interface anymore? The SQL parser example is a loooong source dump; a shorter example would help to focus on principles, and allow room for more liberal commenting. I far prefer this book over man pages, but the title could stand a refresh. (Review Data Last Updated: 2006-06-14 13:41:44 EST)
|
|||||||||||||||||||||||||||||
| Reader Reviews 1 - 15 of 15 | |||||||||||||||||||||||||||||
| All Books | Arts | Biography | Click Here For An A-Z Index Of All 213 Best-Seller Subjects | Business | Children's | Comics | ||||||
| Computers | Cooking | Engineering | Entertainment | Health | History | Home | Horror | Humor | Law | Fiction | Medicine | Mystery |
| Nonfiction | Outdoors | Parenting | Professional | Reference | Religion | Romance | Science | Sci-Fi | Sports | Teens | Travel | |