View Review Details
| Book: |
|
lex & yacc |
| Subject: |
|
lex & yacc, 2nd Edition Review |
| Date: |
|
2003-09-10 14:42:29 |
| From: |
|
Emmet Caulfield
|
|
|
I have a copy of the 1st edition and recently downloaded the sample code.
I have to concur with Andy Wong Man Boon, above, that the sample code is pretty crummy. I downloaded the code because I'd a particular interest in the SQL grammar, and found that the sql1 example didn't compile, complaining about being unable to resolve yywrap(). After fixing this problem (either by linking with -lfl or putting in a substitute yywrap()), I then found that the executable gave:
<blockquote>
1: syntax error at FROM
SQL parse failed
</blockquote>
when fed SELECT foo FROM bar;!
Now, I'm no expert (otherwise I wouldn't have the book), but it seems to me that simple queries like this aren't allowed by the grammar in sql1.y. I got it to work by putting the following into the grammar:
<blockquote>
sql: query_exp
;
</blockquote>
How trustworthy can the code, or the book, be when this kind of simple mistake is made?
Emmet
|
|
| |