help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bison 1.29 slash problem


From: Charlie Zender
Subject: Bison 1.29 slash problem
Date: Mon, 9 Sep 2002 22:43:10 -0700

Hi,

I ran into a problem while trying to build a program with bison 1.29.
My parser is in the file ncap_yacc.y, but in the directory ../src/nco,
thus the Makefile generates and executes the command:

bison --output=../src/nco/ncap_yacc.c -d ../src/nco/ncap_yacc.y

As of bison 1.29 (on Mac OS X sourceforge compile farm), the
ncap_yacc.h file contains a #ifndef TOKEN couplet where 
TOKEN=__/SRC/NCO/NCAP_YACC_H and the slashes in TOKEN confuse
the compiler, which dies.
As far as I know, this worked fine up through bison 1.28, because
bison did not try to protect the contents of the .h file with
the #ifndef couplet. It's actually slightly worse than that because
bison 1.29 appears to prepend the comments after the union members
with an extra slash (see output below).

It seems like bison should be able to handle processing files
in another directory without producing these problems. 
Is this considered to be a problem? Is there a good workaround?

Thanks,
Charlie

address@hidden:~/nco/bld$ uname -a
Darwin usf-cf-ppc-macosx-1 5.5 Darwin Kernel Version 5.5: Thu May 30 14:51:26 
PDT 2002; root:xnu/xnu-201.42.3.obj~1/RELEASE_PPC  Power Macintosh powerpc
address@hidden:~/nco/bld$ bison --version
bison (GNU Bison) 1.29
address@hidden:~/nco/bld$ bison --output=../src/nco/ncap_yacc.c -d 
../src/nco/ncap_yacc.y
address@hidden:~/nco/bld$ more ../src/nco/ncap_yacc.h
#ifndef __/SRC/NCO/NCAP_YACC_H
# define __/SRC/NCO/NCAP_YACC_H

typedef union{
  char *sng; //* [sng] String value */
  char *var_nm_LHS; //* [sng] Variables on LHS */
  char *var_nm_RHS; //* [sng] Variables on RHS */
  aed_sct aed; //* [sct] Attribute */
  sym_sct *sym; //* [sct] Intrinsic function name */
  scv_sct scv; //* [sct] Scalar value */
  var_sct *var; //* [sct] Variable */
  nm_lst_sct *sbs_lst; //* [sct] Subscript list */
  int nco_rlt_opr; //* [enm] Comparison operator type */
} YYSTYPE;

The C-compiler (gcc 2.95.2) then breaks on this header file with these errors:
../src/nco/ncap_yacc.h:1: parse error before `/'
../src/nco/ncap_yacc.h:14: parse error before `}'


-- 
Charlie Zender, zender at uci dot edu, (949) 824-2987, Department of
Earth System Science, University of California, Irvine CA 92697-3100






reply via email to

[Prev in Thread] Current Thread [Next in Thread]