From: egdorf AT zaphod DOT lanl DOT gov (Skip Egdorf) Subject: Bug in byacc/cygwin32 14 Nov 1996 17:50:34 -0800 Sender: daemon AT cygnus DOT com Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <199611141846.LAA26945.cygnus.gnu-win32@zaphod.lanl.gov> Original-To: gnu-win32 AT cygnus DOT com Original-Cc: hwe AT lanl DOT gov, noer AT cygnus DOT com Original-Sender: owner-gnu-win32 AT cygnus DOT com Windows-95, Pentium, Beta-16 A %union in a yacc grammer produces bad output from byacc. I suspect that the problem lies with buffers being output at the wrong times in cygwin32 rather than a bug in byacc itself, but I only have the cygwin32 version of byacc to try... I have reproduced this in two large grammers. Here is a small case. this grammer produces correct output: --- %{ extern int yylex (); extern void yyerror (char *); %} %token A B %% test_program: test_program_sequence ; test_program_sequence: test_program_sequence stmt | /* empty */ ; stmt: A | B ; %% --- Adding a %union: --- %{ extern int yylex (); extern void yyerror (char *); %} %union { long INTEGER; double FLOAT; } %token A B %% test_program: test_program_sequence ; test_program_sequence: test_program_sequence stmt | /* empty */ ; stmt: A | B ; %% --- and compiling with "byacc -d -o test.c test.y" causes errors in the .c andf .h files. Here is the ..h file from the grammer above: --- #define A 257 #define B 258 typedef union { long INTEGER; double FLOAT; }yerror (char *); #line 6 "test1.y" typedef union { long INTEGER; double FLOAT; } YYSTYPE; YYSTYPE; extern YYSTYPE yylval; --- Note that the %union generates two typedefs, with the first walking onto the user-code in the grammer. e.g. the "yerror (char *)" at the end of the irst typedef is a fragment of the code from %{ extern int yylex (); extern void yyerror (char *); %} Skip Egdorf hwe AT lanl DOT gov - For help on using this list, send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".