Thread View: comp.bugs.misc
2 messages
2 total messages
Started by dave
Wed, 13 May 1987 05:40
Lex/Yacc bug
Author: dave
Date: Wed, 13 May 1987 05:40
Date: Wed, 13 May 1987 05:40
71 lines
2182 bytes
2182 bytes
Is this a bug in lex?
On the AT&T 3B2 Sys V and Sun 3/180 Sun Unix 3.0
and lex being used with yacc. Lex busts when used with a token
defined in yacc as "p" "m" or "c".
For example cut up the following.
********* yacc file (foo) **********
%token p
%%
null :
;
%%
#include "lex.yy.c"
main()
{
yyparse();
}
********** lex file (bar)************
%%
********** type the following *******
yacc foo
lex bar
cc -o blah y.tab.c -ll
*****you should get something like***
"./lex.yy.c", line 232: syntax error at or near constant 257
"./lex.yy.c", line 233: syntax error at or near constant 257
"./lex.yy.c", line 236: illegal indirection
"./lex.yy.c", line 238: illegal lhs of assignment operator
"./lex.yy.c", line 238: illegal indirection
********** offensive code follows ***
********** from /usr/lib/lex/ncform *
yyback(p, m)
int *p;
{
if (p==0) return(0);
while (*p)
{
if (*p++ == m)
return(1);
}
return(0);
}
/* the following are only used in the lex library */
yyinput(){
return(input());
}
yyoutput(c)
int c; {
output(c);
}
yyunput(c)
int c; {
unput(c);
}
*********
Shouldn't these declarations use obscure variable names like yym yyp yyc ?
David R. Seaman
------
{utai,utzoo}!sq!dave ssssss
s s
SoftQuad Inc. (home of sqtroff) sss s
720 Spadina Ave s s s
Toronto, Ontario, Canada s s s
(416) 963-8337 ssssss
s
ssq
Re: Lex/Yacc bug
Author: gamiddleton
Date: Thu, 14 May 1987 19:53
Date: Thu, 14 May 1987 19:53
18 lines
980 bytes
980 bytes
In article <1987May13.014036.21651@sq.uucp> dave@sq.uucp (David R. Seaman) writes: > ... Lex busts when used with a token > defined in yacc as "p" "m" or "c". > > For example cut up the following. > > ********* yacc file (foo) ********** > %token p > %% > null : > ... Yes, lex uses dumb variable names. But try this: %token for %token return ... etc. Whole screens full of error messages.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads