Date: Thu, 5 Dec 1996 19:13:37 -0700 (MST) From: Terry Lambert <terry@lambert.org> To: hackers@freebsd.org Subject: Yacc -p<NAME> is broken Message-ID: <199612060213.TAA21534@phaeton.artisoft.com>
next in thread | raw e-mail | index | archive | help
When you generate a y.tab.h file using yacc -p<NAME>... ie: yacc -v -p<NAME> In the file y.tab.h, you get: ... extern YYSTYPE <NAME>lval; In reality, you should get: ... #define yylval <NAME>lval extern YYSTYPE yylval; This is because lex grammars frequently include y.tab.h: %{ #include "y.tab.h" #include <math.h> #include <string.h> ... %} %% ... and the value of yylval in the lexer is dependent on the value in the yacc grammar -- which is dependent on the -p<NAME> parameter (in y.tab.c, there is a: #define yylval <NAME>lval Frequently, if you are mixing grammars, you have a -P<NAME> on the lex to go with the -p<NAME> on the yacc... Regards, Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612060213.TAA21534>