From owner-freebsd-hackers Thu Dec 5 19:25:29 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id TAA25020 for hackers-outgoing; Thu, 5 Dec 1996 19:25:29 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id TAA25013 for ; Thu, 5 Dec 1996 19:25:25 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id TAA21534 for hackers@freebsd.org; Thu, 5 Dec 1996 19:13:38 -0700 From: Terry Lambert Message-Id: <199612060213.TAA21534@phaeton.artisoft.com> Subject: Yacc -p is broken To: hackers@freebsd.org Date: Thu, 5 Dec 1996 19:13:37 -0700 (MST) X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk When you generate a y.tab.h file using yacc -p... ie: yacc -v -p In the file y.tab.h, you get: ... extern YYSTYPE lval; In reality, you should get: ... #define yylval lval extern YYSTYPE yylval; This is because lex grammars frequently include y.tab.h: %{ #include "y.tab.h" #include #include ... %} %% ... and the value of yylval in the lexer is dependent on the value in the yacc grammar -- which is dependent on the -p parameter (in y.tab.c, there is a: #define yylval lval Frequently, if you are mixing grammars, you have a -P on the lex to go with the -p 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.