Most Helpful Customer Reviews
|
|
41 of 44 people found the following review helpful:
3.0 out of 5 stars
OK for what it is, May 26, 2001
WHAT IT IS: A sparse crash course 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 might be 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 *useless* Yacc examples are at least complete; the ones I found on the web all required major surgery or additional pieces to work. The only problem I had with these 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 (included w/ DBMS) 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 books on parser construction now. This book doesn't get into that.
|
|
|
16 of 16 people found the following review helpful:
2.0 out of 5 stars
Incomplete, poorly organized, and not very well written, April 6, 1999
By A Customer
As with several other O'Reilly books, I found Lex & Yacc to be maddeningly uneven. The approach is to give a too-brief synopsis of the tool, then illustrate its use using a very specific example that, one suspects, is merely the handiest project the authors had available.I had a fair bit of programming experience when I bought the book, but none with Lex or Yacc. Some fundamental questions came up during the course of my muddling through, and these were left unanswered. I actually got more insight into these tools from a ~20-page web site on the topic. The reference chapters are organized alphabetically ("ambiguities & conflicts", "bugs", ..., "%ident declaration"), and in a way that does not help someone who is looking for a specific answer (in trying to find out about the possibility of more than one parser in a program, who would think to look under 'v' for "variant and multiple grammars"?). These 'reference chapters' seemed more like a place to dump the information not discussed elsewhere. Maybe it's a lost cause, finding a comprehensive, well-written introduction to such an arcane topic, but I'm still looking.
|
|
|
12 of 12 people found the following review helpful:
2.0 out of 5 stars
ok, but there is a better LEX/YACC book, April 26, 2004
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.
|
|
|
Most Recent Customer Reviews
|