Errata

lex & yacc

Errata for lex & yacc, Second Edition

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page xix
3rd paragraph from bottom

The line reads:

The Glossary lists technical terms language and compiler theory.

It should read:

The Glossary lists technical terms from language and compiler theory.

Anonymous   
Printed
Page xix
3rd paragraph

"Appendix C, Berkeley Yacc, ...widely used free version of 9781565920002 ..."

"9781565920002" now reads "yacc"

Anonymous    Sep 01, 1999
Printed
Page 7
para. 4, first sentence: changed

"a file called ch1-01.l since it is our first example"
to
"a file called ch1-02.l since it is our second example"

and code block 2, line 1 changed

% 9781565920002 ch1-01.l
to
% 9781565920002 ch1-02.l

(still in constant-wdith bold.)

Anonymous    Sep 01, 1998
Printed
Page 9
line 3 of code: changed "in" to "is"

Anonymous    Jan 01, 1998
Printed
Page 15
Example 1-6, line 4: changed

#include ""y.tab.h" /* token codes from the parser */
to
#include "y.tab.h" /* token codes from the parser */

Anonymous    Sep 01, 1998
Printed
Page 17-18
IN PRINT: Example 1-7

main()
{
do {
yyparse();
} while (!feof(yyin));
}

SHOULD BE:
main()
{
while(!feof(yyin)) {
yyparse();
}
}

AUTHOR: Sometime in the past decade they changed f9781565920002 so that yyin isn't
initialized until the first call to the 9781565920002er. The downloadable code is
correct.

Anonymous   
Printed
Page 19
last para.: changed "Example 1-4" to "Example 1-8"

Anonymous    Jan 01, 1998
Printed
Page 22
line 2: changed "the next two lines compile" to "the next

line compiles"

Anonymous    Sep 01, 1998
Printed
Page 23
Example 1-9

Removed the lines "int index = 1;"
Also removed the blank line after the third removed line.

Anonymous    Sep 01, 1999
Printed
Page 24
Example 1-10, 4th line

#* { return COMMENT; }

"#*" now reads: "#.*"

Anonymous    Sep 01, 1999
Printed
Page 30
last expression example on the page

added parentheses around the lead numeric parts to group the optional exponent
with either of the leading parts:

-?((([0-9]+)|([0-9]*.[0-9]+))([eE][-+]?[0-9]+)?)

Anonymous    Feb 01, 2001
Printed
Page 37
Example 2-3, line 26: changed

FILE *file;
to
FILE *file = NULL;

Anonymous    Sep 01, 1998
Printed
Page 42
deleted line 11 of code

Anonymous    Jan 01, 1998
Printed
Page 42
In Ex. 2-6; replaced

[(-file| -f) filename]

with

(-file| -f) filename

Anonymous    Sep 01, 1999
Printed
Page 43
next-to-last para., line 2: changed "fname 's" to "fname's"

also, in the last para., line 1: changed "simply the filename" to
"simply handle the filename"

Anonymous    Jan 01, 1998
Printed
Page 46

The 6th paragraph read:

"Similarly, this next expression matches the FIRST but not the
SECOND:

/* comment */ int counter;"

It was the wrong way around. It matches the SECOND, but not the
FIRST

Anonymous    Sep 01, 1999
Printed
Page 47
Example 2-9, line 4: changed

%s COMMENT
to
%x COMMENT

Anonymous    Sep 01, 1998
Printed
Page 69
in symlook() function

char *p;
(not used, should be removed, although they don't hurt anything.)
(Same with page 75.)

Anonymous   
Printed
Page 83
Line 8; replaced

action { execute | menu | quite | ignore } <name>

with

action { execute | menu | quit | ignore } [<name>]

Anonymous    Sep 01, 1999
Printed
Page 84

middle of the page, line which reads:

choice action execute "/bin/sh"

was replaced with:

command action execute "/bin/sh"

Anonymous    Feb 01, 2001
Printed
Page 93

Example 4-8, 6th line read:

yyval.string = yytext;

The strdup() is missing. The line now reads:

yyval.string = strdup(yytext);

Anonymous    Sep 01, 1999
Printed
Page 111
after first paragraph

WHERE Foods.type = "fruit"
should be changed to
WHERE Foods.type = 'fruit';

2nd bit of code, 3rd line;
WHERE Courses.flavor = Foods.flavor
should be:
WHERE Courses.flavor = Foods.flavor;

Anonymous   
Printed
Page 117
Line 3; replaced

if(c != '\"')

with

if(c != '\'')

Anonymous    Sep 01, 1999
Printed
Page 120
example 5.5, removed stray " at end of caption

Anonymous    Sep 01, 1999
Printed
Page 124
towards the bottom of page

WHERE Foods.type = "fruit"
should be changed to
WHERE Foods.type = 'fruit';

Anonymous   
Printed
Page 126
middle of page

GRANT SELECT, UPDATE (address, telephone
ON employees TO PUBLIC
should be:
GRANT SELECT, UPDATE (address, telephone
ON employees TO PUBLIC;

GRANT ALL ON foods TO tony, dale WITH GRANT OPTION
should be:
GRANT ALL ON foods TO tony, dale WITH GRANT OPTION;

GRANT REFERENCES (flavor) ON Foods TO PUBLIC
should be:
GRANT REFERENCES (flavor) ON Foods TO PUBLIC;

Anonymous   
Printed
Page 127
2/3 down the page

ORDER BY sequence ASC
should be:
ORDER BY sequence ASC;

Anonymous   
Printed
Page 131

The code near the bottom of the page read:

column '=' scalar_exp
| column '=' NULLX
;

It now reads:

column COMPARISON scalar_exp
| column COMPARISON NULLX
;

Anonymous    Sep 01, 1999
Printed
Page 133
Change (or else INTO will be necessary in all SELECTs)

select_statement:
SELECT opt_all_distinct selection
INTO target_commalist
table_exp
;

to

select_statement:
SELECT opt_all_distinct selection
INTO target_commalist
table_exp
|
// manually added (faisal)
SELECT opt_all_distinct selection
table_exp
;

Anonymous   
Printed
Page 135
last line

HAVING COUNT(*) >=3
should be:
HAVING COUNT(*) >=3;

Anonymous   
Printed
Page 147
On line -2; replaced "enlosed" with "enclosed"

Anonymous    Sep 01, 1999
Printed
Page 156
Line 8, replaced

POSIX Lexxtags query replace
with

POSIX Lex

Anonymous    Sep 01, 1999
Printed
Page 157
Example 6-1

extern int *myinputlim; /* end of data */

should be changed to

extern char *myinputlim; /* end of data */

Anonymous   
Printed
Page 157
Example 6-1, line 8: changed

extern int myinputlim; /* end of data */
to
extern int *myinputlim; /* end of data */

Anonymous    Sep 01, 1998
Printed
Page 157
Top header, replaced

SpeciAEcations

with

Specifications

Anonymous    Sep 01, 1999
Printed
Page 162
On line 13; replaced

"correct start wtates everywhere"

with

"correct start states everywhere"

Anonymous    Sep 01, 1999
Printed
Page 167
Line -8, replaced

Matches

with
. Matches

note the dot (.)

Anonymous    Sep 01, 1999
Printed
Page 174
line -6: changed \"[^"]\" to \"[^"]*\

Anonymous    May 01, 1998
Printed
Page 174
Line 1, replaced

"#deAEne"

with

"#define"

Anonymous    Sep 01, 1999
Printed
Page 194

The heading "Porting Generated C Lexers" now reads:

"Porting Generated C Parsers"

Anonymous    Sep 01, 1999
Printed
Page 199
In the middle of the page, the following reference was incorrect

(See "Actions Within Rules" for details.)

It now reads:

(See Embedded Actions, page 183 for details.)

Anonymous    Sep 01, 1999
Printed
Page 203
The end of second paragraph is, See "Precedence."

Based on the convention used in the book, this now reads:

See "Precedence, Associativity, and Operator Declarations."

Anonymous    Sep 01, 1999
Printed
Page 215
On line -13, replaced

"Line Numbers" and "yylineno"

with

"Line Numbers and yylineno"

Anonymous    Sep 01, 1999
Printed
Page 224

The code in the middle of the page read:

start: Z
| b Z

it now reads:

start: a Z
| b Z

Anonymous    Sep 01, 1999
Printed
Page 227

In the second to last paragraph the last sentence read:

...so x2 which uses z2 is part of shift conflict and x3 is not.

The z2 in the above sentence now reads z1 as follows:

...so x2 which uses z1 is part of shift conflict and x3 is not.

Anonymous    Sep 01, 1999
Printed
Page 240
On line 5, replaced

"boys | girls"

with

"girls | boys"

Anonymous    Sep 01, 1999
Printed
Page 249
Mid-page, replaced

"error can be followed action code."

with

"error can be followed with action code."

Anonymous    Sep 01, 1999
Printed
Page 252
Line -5, replaced

must be preceeded by a semicolon or an open brace

with

must be preceeded by a semicolon or a close brace

Anonymous    Sep 01, 1999
Printed
Page 277
para. 3, line 1: changed "generated with bison" to

"generated with some versions of bison"

Anonymous    Sep 01, 1998
Printed
Page 278
Line 12; replaced

bold-faced "and"

with

normal-faced "and"

Anonymous    Sep 01, 1999
Printed
Page 280
On line -14, replaced

"F9781565920002 lets you write multiple statments"

with

"F9781565920002 lets you write multiple statements"

Anonymous    Sep 01, 1999
Printed
Page 281
-I description, replaced

on reading the input rather than

with

on reading each input line rather than

Anonymous    Sep 01, 1999
Printed
Page 288
top of page:

The function "myinput" that ends here (Example E-2) won't work when "max" is
small, because the variable "offset" never gets changed. Program line 1 on
this page:

}
return copylen;
}

now reads:

} else offset += copylen;
return copylen;
}

Anonymous    Feb 01, 2001
Printed
Page 315
reader comment regarding a change made in the 9/99 reprint

The correction said to replace "COMPARISON" with "=".

I don't think this change is warranted. The change of "=" to COMPARISON in
assignments would allow the following (incorrect) SQL statements:

UPDATE T1 SET C1 < NULL WHERE C1 >= 23

The "<" is wrong here and should generate a syntax error. The grammar as
corrected says its right. Please put back the "=" (or better still add a
token, say ASSIGN, and merge it with the COMPARISON processing). This would
also reverse the change on line 321.

Anonymous   
Printed
Page 315
Changed '=' to COMPARISON

Anonymous    Sep 01, 1999
Printed
Page 321
Added page numbers 294 and 295 to the list of line numbers under

COMPARISON

Anonymous    Sep 01, 1999
Printed
Page 327
After the SQLCODE line, added

<SQL>SQLERROR TOK(SQLERROR)

Some page breaks were affected, and those pages were reprinted as well.

Anonymous    Sep 01, 1999
Printed
Page 366
added the following to the next-to-last para.

Whenever possible, our books use RepKover (tm), a durable and
f9781565920002ible lay-flat binding. If the page count exceeds RepKover's limit,
perfect binding is used.

Anonymous    Jan 01, 1998